-
Notifications
You must be signed in to change notification settings - Fork 0
/
io_test.go
88 lines (68 loc) · 1.44 KB
/
io_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
package mo
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestIO(t *testing.T) {
is := assert.New(t)
io := NewIO(func() int {
return 42
})
result := io.Run()
is.Equal(42, result)
}
func TestIO1(t *testing.T) {
is := assert.New(t)
io := NewIO1(func(a string) int {
is.Equal("foo", a)
return 42
})
result := io.Run("foo")
is.Equal(42, result)
}
func TestIO2(t *testing.T) {
is := assert.New(t)
io := NewIO2(func(a string, b string) int {
is.Equal("foo", a)
is.Equal("bar", b)
return 42
})
result := io.Run("foo", "bar")
is.Equal(42, result)
}
func TestIO3(t *testing.T) {
is := assert.New(t)
io := NewIO3(func(a string, b string, c string) int {
is.Equal("foo", a)
is.Equal("bar", b)
is.Equal("hello", c)
return 42
})
result := io.Run("foo", "bar", "hello")
is.Equal(42, result)
}
func TestIO4(t *testing.T) {
is := assert.New(t)
io := NewIO4(func(a string, b string, c string, d string) int {
is.Equal("foo", a)
is.Equal("bar", b)
is.Equal("hello", c)
is.Equal("world", d)
return 42
})
result := io.Run("foo", "bar", "hello", "world")
is.Equal(42, result)
}
func TestIO5(t *testing.T) {
is := assert.New(t)
io := NewIO5(func(a string, b string, c string, d string, e bool) int {
is.Equal("foo", a)
is.Equal("bar", b)
is.Equal("hello", c)
is.Equal("world", d)
is.True(e)
return 42
})
result := io.Run("foo", "bar", "hello", "world", true)
is.Equal(42, result)
}