Version bump.
[stompngo.git] / nack_test.go
blob15db3db5ff867a3a9af7953f2fbc8784773da966
1 //
2 // Copyright © 2011-2019 Guy M. Allard
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 package stompngo
19 import (
20 "fmt"
21 "testing"
24 var _ = fmt.Println
27 Test Nack error cases.
29 func TestNackErrors(t *testing.T) {
30 n, _ = openConn(t)
31 ch := login_headers
32 ch = headersProtocol(ch, sp)
33 conn, e = Connect(n, ch)
34 if e != nil {
35 t.Fatalf("TestNackErrors CONNECT expected no error, got [%v]\n", e)
37 for ti, tv := range nackList {
38 conn.protocol = tv.proto // Fake it
39 e = conn.Nack(tv.headers)
40 if e != tv.errval {
41 t.Fatalf("TestNackErrors[%d] NACK -%s- expected error [%v], got [%v]\n",
42 ti, tv.proto, tv.errval, e)
46 checkReceived(t, conn, false)
47 e = conn.Disconnect(empty_headers)
48 checkDisconnectError(t, e)
49 _ = closeConn(t, n)