-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment_test.go
60 lines (53 loc) · 1.27 KB
/
environment_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
package docker
import (
"testing"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
)
func init() {
log.SetLevel(log.TraceLevel)
}
func TestEnvironmentBuilder(t *testing.T) {
r := require.New(t)
e := NewEnvironment().
StringVar("string_var", "string_value").
IntVar("int_var", int(1234)).
Int64Var("int64_var", int64(5678)).
Int32Var("int32_var", int32(9012)).
Int16Var("int16_var", int16(3456)).
Int8Var("int8_var", int8(126)).
UintVar("uint_var", uint(987)).
Uint64Var("uint64_var", uint64(654)).
Uint32Var("uint32_var", uint32(321)).
Uint16Var("uint16_var", uint16(9087)).
Uint8Var("uint8_var", uint8(255)).
BoolVar("bool_var", true)
r.Equal(Environment{
"string_var": "string_value",
"int_var": "1234",
"int64_var": "5678",
"int32_var": "9012",
"int16_var": "3456",
"int8_var": "126",
"uint_var": "987",
"uint64_var": "654",
"uint32_var": "321",
"uint16_var": "9087",
"uint8_var": "255",
"bool_var": "true",
}, e)
r.ElementsMatch([]string{
"string_var=string_value",
"int_var=1234",
"int64_var=5678",
"int32_var=9012",
"int16_var=3456",
"int8_var=126",
"uint_var=987",
"uint64_var=654",
"uint32_var=321",
"uint16_var=9087",
"uint8_var=255",
"bool_var=true",
}, e.list())
}