-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtask_test.go
99 lines (76 loc) · 1.81 KB
/
task_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
97
98
99
package dingo
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTaskEqual(t *testing.T) {
ass := assert.New(t)
// same
{
m1 := map[string]string{
"t1": "1",
"t2": "2",
}
m2 := map[string]string{
"t1": "1",
"t2": "2",
}
t, err := composeTask("name#1", nil, []interface{}{1, "test123", m1})
ass.Nil(err)
o, err := composeTask("name#1", nil, []interface{}{1, "test123", m2})
ass.Nil(err)
o.H.I = t.H.ID()
ass.Equal(o, t)
}
// diff map
{
t, err := composeTask("name#1", nil, []interface{}{1, "test123", map[string]string{
"t1": "1",
"t2": "2",
}})
ass.Nil(err)
o, err := composeTask("name#1", nil, []interface{}{1, "test123", map[string]string{
"t2": "2",
"t3": "3",
}})
ass.Nil(err)
o.H.I = t.H.ID()
ass.NotEqual(t, o)
}
// only Name is different
{
t, err := composeTask("name#1", nil, []interface{}{1, "test#123"})
ass.Nil(err)
o, err := composeTask("name#2", nil, []interface{}{1, "test#123"})
ass.Nil(err)
o.H.I = t.H.ID()
ass.NotEqual(t, o)
}
// sequence of args is different
{
t, err := composeTask("name#1", nil, []interface{}{1, "test#123"})
ass.Nil(err)
o, err := composeTask("name#1", nil, []interface{}{"test#123", 1})
ass.Nil(err)
o.H.I = t.H.ID()
ass.NotEqual(t, o)
}
// different args
{
t, err := composeTask("name#1", nil, []interface{}{1, "test#123"})
ass.Nil(err)
o, err := composeTask("name#1", nil, []interface{}{2, "test#123"})
ass.Nil(err)
o.H.I = t.H.ID()
ass.NotEqual(t, o)
}
// different option
{
t, err := composeTask("name#1", DefaultOption().IgnoreReport(true), []interface{}{1, "test#123"})
ass.Nil(err)
o, err := composeTask("name#1", DefaultOption().IgnoreReport(false), []interface{}{2, "test#123"})
ass.Nil(err)
o.H.I = t.H.ID()
ass.NotEqual(t, o)
}
}