-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_test.go
85 lines (69 loc) · 1.98 KB
/
map_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package assert_test
import (
"testing"
. "github.com/pierrre/assert"
"github.com/pierrre/assert/asserttest"
)
func TestMapNil(t *testing.T) {
ok := MapNil(t, map[string]string(nil))
True(t, ok)
}
func TestMapNilFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapNil(t, map[string]string{}, Report(report))
False(t, ok)
}
func TestMapNotNil(t *testing.T) {
ok := MapNotNil(t, map[string]string{})
True(t, ok)
}
func TestMapNotNilFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapNotNil(t, map[string]string(nil), Report(report))
False(t, ok)
}
func TestMapEmpty(t *testing.T) {
ok := MapEmpty(t, map[string]string{})
True(t, ok)
}
func TestMapEmptyFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapEmpty(t, map[string]string{"foo": "bar"}, Report(report))
False(t, ok)
}
func TestMapNotEmpty(t *testing.T) {
ok := MapNotEmpty(t, map[string]string{"foo": "bar"})
True(t, ok)
}
func TestMapNotEmptyFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapNotEmpty(t, map[string]string{}, Report(report))
False(t, ok)
}
func TestMapLen(t *testing.T) {
ok := MapLen(t, map[string]string{"foo": "bar"}, 1)
True(t, ok)
}
func TestMapLenFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapLen(t, map[string]string{"foo": "bar"}, 2, Report(report))
False(t, ok)
}
func TestMapEqual(t *testing.T) {
ok := MapEqual(t, map[string]string{"foo": "bar"}, map[string]string{"foo": "bar"})
True(t, ok)
}
func TestMapEqualFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapEqual(t, map[string]string{"foo": "bar"}, map[string]string{}, Report(report))
False(t, ok)
}
func TestMapNotEqual(t *testing.T) {
ok := MapNotEqual(t, map[string]string{"foo": "bar"}, map[string]string{})
True(t, ok)
}
func TestMapNotEqualFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := MapNotEqual(t, map[string]string{"foo": "bar"}, map[string]string{"foo": "bar"}, Report(report))
False(t, ok)
}