Skip to content

Commit df5956e

Browse files
committed
Use testing.Errorf
1 parent aa14d66 commit df5956e

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

list_test.go

+11-22
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ func TestFirstOne(t *testing.T) {
99
correct := New("a")
1010
out := First(correct)
1111
if out != correct {
12-
t.Logf("\n%#v\n!=\n%#v\n", out, correct)
13-
t.Fail()
12+
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
1413
}
1514
}
1615

@@ -20,8 +19,7 @@ func TestFirstThree(t *testing.T) {
2019
e3 := New("c")
2120
out := First(Append(correct, e2, e3))
2221
if !reflect.DeepEqual(out, correct) {
23-
t.Logf("\n%#v\n!=\n%#v\n", out, correct)
24-
t.Fail()
22+
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
2523
}
2624
}
2725

@@ -33,8 +31,7 @@ func TestMulti_Merr(t *testing.T) {
3331
out := Append(e1, e23)
3432
correct := &errorList{[]error{e1, e2, e3}}
3533
if !reflect.DeepEqual(out, correct) {
36-
t.Logf("\n%#v\n!=\n%#v\n", out, correct)
37-
t.Fail()
34+
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
3835
}
3936
}
4037

@@ -44,8 +41,7 @@ func TestMulti_ErrErrX(t *testing.T) {
4441
out := Append(e2, e1)
4542
correct := &errorList{[]error{e2, e1}}
4643
if !reflect.DeepEqual(out, correct) {
47-
t.Logf("\n%#v\n!=\n%#v\n", out, correct)
48-
t.Fail()
44+
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
4945
}
5046
}
5147

@@ -55,58 +51,51 @@ func TestMulti_ErrErr(t *testing.T) {
5551
out := Append(e1, e2)
5652
correct := &errorList{[]error{e1, e2}}
5753
if !reflect.DeepEqual(out, correct) {
58-
t.Logf("\n%#v\n!=\n%#v\n", out, correct)
59-
t.Fail()
54+
t.Errorf("\n%#v\n!=\n%#v\n", out, correct)
6055
}
6156
}
6257

6358
func TestMulti_ErrNil(t *testing.T) {
6459
e := New("a")
6560
out := Append(e, nil)
6661
if out != e {
67-
t.Logf("%#v != %#v\n", out, e)
68-
t.Fail()
62+
t.Errorf("%#v != %#v\n", out, e)
6963
}
7064
}
7165

7266
func TestMulti_NilErr(t *testing.T) {
7367
e := New("a")
7468
out := Append(nil, e)
7569
if out != e {
76-
t.Logf("%#v != %#v\n", out, e)
77-
t.Fail()
70+
t.Errorf("%#v != %#v\n", out, e)
7871
}
7972
}
8073

8174
func TestMulti_Err(t *testing.T) {
8275
e := New("a")
8376
out := Append(e)
8477
if out != e {
85-
t.Logf("%#v != %#v\n", out, e)
86-
t.Fail()
78+
t.Errorf("%#v != %#v\n", out, e)
8779
}
8880
}
8981

9082
func TestMulti_NilNilNil(t *testing.T) {
9183
out := Append(nil, nil, nil)
9284
if out != nil {
93-
t.Logf("%#v\n", out)
94-
t.Fail()
85+
t.Errorf("%#v\n", out)
9586
}
9687
}
9788

9889
func TestMulti_NilNil(t *testing.T) {
9990
out := Append(nil, nil)
10091
if out != nil {
101-
t.Logf("%#v\n", out)
102-
t.Fail()
92+
t.Errorf("%#v\n", out)
10393
}
10494
}
10595

10696
func TestMulti_Nil(t *testing.T) {
10797
out := Append(nil)
10898
if out != nil {
109-
t.Logf("%#v\n", out)
110-
t.Fail()
99+
t.Errorf("%#v\n", out)
111100
}
112101
}

0 commit comments

Comments
 (0)