-
Notifications
You must be signed in to change notification settings - Fork 0
/
string_test.go
96 lines (78 loc) · 2.01 KB
/
string_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
86
87
88
89
90
91
92
93
94
95
96
package assert_test
import (
"testing"
. "github.com/pierrre/assert"
"github.com/pierrre/assert/asserttest"
)
func TestStringEmpty(t *testing.T) {
ok := StringEmpty(t, "")
True(t, ok)
}
func TestStringEmptyFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringEmpty(t, "abc", Report(report))
False(t, ok)
}
func TestStringNotEmpty(t *testing.T) {
ok := StringNotEmpty(t, "abc")
True(t, ok)
}
func TestStringNotEmptyFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringNotEmpty(t, "", Report(report))
False(t, ok)
}
func TestStringLen(t *testing.T) {
ok := StringLen(t, "abc", 3)
True(t, ok)
}
func TestStringLenFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringLen(t, "abc", 4, Report(report))
False(t, ok)
}
func TestStringContains(t *testing.T) {
ok := StringContains(t, "abc", "bc")
True(t, ok)
}
func TestStringContainsFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringContains(t, "abc", "bd", Report(report))
False(t, ok)
}
func TestStringNotContains(t *testing.T) {
ok := StringNotContains(t, "abc", "bd")
True(t, ok)
}
func TestStringNotContainsFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringNotContains(t, "abc", "bc", Report(report))
False(t, ok)
}
func TestStringHasPrefix(t *testing.T) {
ok := StringHasPrefix(t, "abc", "ab")
True(t, ok)
}
func TestStringHasPrefixFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringHasPrefix(t, "abc", "ac", Report(report))
False(t, ok)
}
func TestStringHasSuffix(t *testing.T) {
ok := StringHasSuffix(t, "abc", "bc")
True(t, ok)
}
func TestStringHasSuffixFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringHasSuffix(t, "abc", "ac", Report(report))
False(t, ok)
}
func TestStringEqualFold(t *testing.T) {
ok := StringEqualFold(t, "abc", "ABC")
True(t, ok)
}
func TestStringEqualFoldFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := StringEqualFold(t, "abc", "ABD", Report(report))
False(t, ok)
}