-
Notifications
You must be signed in to change notification settings - Fork 3
/
util_test.go
54 lines (52 loc) · 913 Bytes
/
util_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
package orwell
import (
"testing"
)
func TestNoe(t *testing.T) {
t.Run("String", func(t *testing.T) {
if NOE("test") {
t.Error("Expected false")
}
})
t.Run("StringEmpty", func(t *testing.T) {
var test string
if !NOE(test) {
t.Error("Expected true")
}
})
t.Run("StringDefault", func(t *testing.T) {
if !NOE("") {
t.Error("Expected true")
}
})
t.Run("Int", func(t *testing.T) {
if NOE(1) {
t.Error("Expected false")
}
})
t.Run("IntEmpty", func(t *testing.T) {
var test int
if !NOE(test) {
t.Error("Expected true")
}
})
t.Run("IntDefault", func(t *testing.T) {
if !NOE(0) {
t.Error("Expected true")
}
})
t.Run("Map", func(t *testing.T) {
m := make(map[int]int)
m[0] = 1
m[1] = 2
if NOE(m) {
t.Error("Expected false")
}
})
t.Run("MapEmpty", func(t *testing.T) {
m := make(map[int]int)
if !NOE(m) {
t.Error("Expected true")
}
})
}