-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
example_test.go
70 lines (58 loc) · 1.26 KB
/
example_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
package mint_test
import (
"os"
"testing"
"github.com/otiai10/mint"
)
func ExampleExpect(t *testing.T) {
mint.Expect(t, 100).ToBe(100)
mint.Expect(t, 100).TypeOf("int")
}
func ExampleTestee_ToBe(t *testing.T) {
mint.Expect(t, 100).ToBe(100)
}
func ExampleTestee_Match(t *testing.T) {
mint.Expect(t, "3.05.00dev").Match("[0-9].[0-9]{2}(.[0-9a-z]+)?")
}
func ExampleTestee_TypeOf(t *testing.T) {
mint.Expect(t, 100).TypeOf("int")
}
func ExampleTestee_In(t *testing.T) {
mint.Expect(t, 100).In(10, 100, 1000)
}
func ExampleTestee_Not(t *testing.T) {
mint.Expect(t, 100).Not().ToBe(200)
mint.Expect(t, 100).Not().TypeOf("string")
}
func ExampleTestee_Deeply(t *testing.T) {
map0 := &map[int]string{
3: "three",
5: "five",
10: "ten",
}
map1 := &map[int]string{
3: "three",
5: "five",
10: "ten",
}
mint.Expect(t, map0).Not().ToBe(map1)
mint.Expect(t, map0).Deeply().ToBe(map1)
}
func ExampleTestee_Dry(t *testing.T) {
result := mint.Expect(t, 100).Dry().ToBe(100)
if !result.OK() {
t.Fail()
}
}
func ExampleBlend(t *testing.T) {
// get blended mint
m := mint.Blend(t)
m.Expect(100).ToBe(100)
m.Expect(100).Not().ToBe(200)
}
func ExampleExit(t *testing.T) {
unsuccessful := func() {
os.Exit(1)
}
mint.Expect(t, unsuccessful).Not().Exit(0)
}