-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlockdown_test.go
65 lines (60 loc) · 1.09 KB
/
lockdown_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"testing"
)
type tPM struct {
in string
extra []interface{}
expected string
}
func TestPaddedMsgs(t *testing.T) {
pms := NewPaddedMsgs()
pmList := []tPM{
{
"test1:",
[]interface{}{"some extra", "data", 3},
"test1: some extra data 3",
},
{
"t1:",
[]interface{}{"some other", "extra data", 2},
" t1: some other extra data 2",
},
{
"test2:",
[]interface{}{"moar extra data"},
"test2: moar extra data",
},
{
"this is test 3:",
[]interface{}{},
"this is test 3:",
},
{
"test1:",
[]interface{}{"extra", "data"},
" test1: extra data",
},
{
"this is another test 4:",
[]interface{}{4},
"this is another test 4: 4",
},
{
"this is another test 5:",
[]interface{}{"five", 6, []byte{7}},
"this is another test 5: five 6 [7]",
},
{
"t1:",
[]interface{}{""},
" t1:",
},
}
for _, pm := range pmList {
msg := pms.Msg(pm.in, pm.extra...)
if msg != pm.expected {
t.Errorf("invalid padded message: expected (%s), got (%s)\n", pm.expected, msg)
}
}
}