2 // Copyright © 2016 Guy M. Allard
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
22 // "github.com/gmallard/stompngo"
25 type headersData
struct {
30 var headersTests10
= []headersData
{
32 {"passcode", "guest"},
35 var headersTests1x
= []headersData
{
37 {"passcode", "guest"},
38 {"accept-version", "1.1"},
40 {"heart-beat", "100,500"},
44 Test utilities defaults. Must run with no environment variables set.
46 func TestConnectHeaders10(t
*testing
.T
) {
48 for _
, v
:= range headersTests10
{
49 val
, ok
:= h
.Contains(v
.key
)
51 t
.Errorf("missing key [%s], expected [%t], got [%t]\n",
56 t
.Errorf("incorrect value, expected [%s], got [%s]\n",
65 func TestConnectHeaders1x(t
*testing
.T
) {
67 _
= os
.Setenv("STOMP_HOST", "testhost")
68 _
= os
.Setenv("STOMP_PROTOCOL", "1.1")
69 _
= os
.Setenv("STOMP_HEARTBEATS", "100,500")
72 for _
, v
:= range headersTests1x
{
73 val
, ok
:= h
.Contains(v
.key
)
75 t
.Errorf("missing key [%s], expected [%t], got [%t]\n",
80 t
.Errorf("incorrect value, expected [%s], got [%s]\n",