-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_test.go
More file actions
101 lines (89 loc) · 1.81 KB
/
list_test.go
File metadata and controls
101 lines (89 loc) · 1.81 KB
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
100
101
package errors
import (
"reflect"
"testing"
)
func TestFirstOne(t *testing.T) {
correct := New("a")
out := First(correct)
if out != correct {
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
}
}
func TestFirstThree(t *testing.T) {
correct := New("a")
e2 := New("b")
e3 := New("c")
out := First(Append(correct, e2, e3))
if !reflect.DeepEqual(out, correct) {
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
}
}
func TestMulti_Merr(t *testing.T) {
e1 := New("a")
e2 := New("b")
e3 := New("c")
e23 := Append(e2, e3)
out := Append(e1, e23)
correct := &errorList{[]error{e1, e2, e3}}
if !reflect.DeepEqual(out, correct) {
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
}
}
func TestMulti_ErrErrX(t *testing.T) {
e1 := New("a")
e2 := New("b")
out := Append(e2, e1)
correct := &errorList{[]error{e2, e1}}
if !reflect.DeepEqual(out, correct) {
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
}
}
func TestMulti_ErrErr(t *testing.T) {
e1 := New("a")
e2 := New("b")
out := Append(e1, e2)
correct := &errorList{[]error{e1, e2}}
if !reflect.DeepEqual(out, correct) {
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
}
}
func TestMulti_ErrNil(t *testing.T) {
e := New("a")
out := Append(e, nil)
if out != e {
t.Errorf("%#v != %#v\n", out, e)
}
}
func TestMulti_NilErr(t *testing.T) {
e := New("a")
out := Append(nil, e)
if out != e {
t.Errorf("%#v != %#v\n", out, e)
}
}
func TestMulti_Err(t *testing.T) {
e := New("a")
out := Append(e)
if out != e {
t.Errorf("%#v != %#v\n", out, e)
}
}
func TestMulti_NilNilNil(t *testing.T) {
out := Append(nil, nil, nil)
if out != nil {
t.Errorf("%#v\n", out)
}
}
func TestMulti_NilNil(t *testing.T) {
out := Append(nil, nil)
if out != nil {
t.Errorf("%#v\n", out)
}
}
func TestMulti_Nil(t *testing.T) {
out := Append(nil)
if out != nil {
t.Errorf("%#v\n", out)
}
}