forked from vcabbage/amqp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conn_test.go
44 lines (38 loc) · 833 Bytes
/
conn_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package amqp
import (
"testing"
)
func TestConnOptions(t *testing.T) {
tests := []struct {
label string
opts []ConnOption
wantProperties map[symbol]interface{}
}{
{
label: "no options",
},
{
label: "multiple properties",
opts: []ConnOption{
ConnProperty("x-opt-test1", "test1"),
ConnProperty("x-opt-test2", "test2"),
ConnProperty("x-opt-test1", "test3"),
},
wantProperties: map[symbol]interface{}{
"x-opt-test1": "test3",
"x-opt-test2": "test2",
},
},
}
for _, tt := range tests {
t.Run(tt.label, func(t *testing.T) {
got, err := newConn(nil, tt.opts...)
if err != nil {
t.Fatal(err)
}
if !testEqual(got.properties, tt.wantProperties) {
t.Errorf("Properties don't match expected:\n %s", testDiff(got.properties, tt.wantProperties))
}
})
}
}