Skip to content

Commit dfb3187

Browse files
committed
Fix t.Fatal misusage
1 parent 694a01e commit dfb3187

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

mapping/mapper_test.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mapping
22

33
import (
4-
"fmt"
54
"log"
65
"testing"
76
"time"
@@ -32,10 +31,10 @@ func TestSeekRaw(t *testing.T) {
3231
t.Fatal("should NOT have found the column")
3332
}
3433
if col != "" {
35-
t.Fatal(fmt.Sprintf("column must be empty, got %s \n", col))
34+
t.Fatalf("column must be empty, got %s \n", col)
3635
}
3736
if val != "" {
38-
t.Fatal(fmt.Sprintf("value must be empty, got %s \n", val))
37+
t.Fatalf("value must be empty, got %s \n", val)
3938
}
4039
}
4140

@@ -69,10 +68,10 @@ func TestSeekMapped(t *testing.T) {
6968
t.Fatal("should NOT have found the column")
7069
}
7170
if col != "" {
72-
t.Fatal(fmt.Sprintf("column must be empty, got %s \n", col))
71+
t.Fatalf("column must be empty, got %s \n", col)
7372
}
7473
if val != "" {
75-
t.Fatal(fmt.Sprintf("value must be empty, got %s \n", val))
74+
t.Fatalf("value must be empty, got %s \n", val)
7675
}
7776
}
7877

@@ -128,10 +127,10 @@ func TestMapper(t *testing.T) {
128127
func compare(t *testing.T, m *Mapper, col string, val string, wantedCol string, wantedVal string) {
129128
fCol, fVal := getMappedData(m.Mapping, m.rules.toEvent, col, val)
130129
if fCol != wantedCol {
131-
t.Fatal(fmt.Sprintf("wrong column: wanted %s, got %s", wantedCol, fCol))
130+
t.Fatalf("wrong column: wanted %s, got %s", wantedCol, fCol)
132131
}
133132
if fVal != wantedVal {
134-
t.Fatal(fmt.Sprintf("wrong value: wanted %s, got %s", wantedVal, fVal))
133+
t.Fatalf("wrong value: wanted %s, got %s", wantedVal, fVal)
135134
}
136135
}
137136

@@ -228,10 +227,10 @@ func TestTurnToShortColumn(t *testing.T) {
228227
t.Fatal("should NOT have found the column")
229228
}
230229
if col != "" {
231-
t.Fatal(fmt.Sprintf("column must be empty, got %s \n", col))
230+
t.Fatalf("column must be empty, got %s \n", col)
232231
}
233232
if val != "" {
234-
t.Fatal(fmt.Sprintf("value must be empty, got %s \n", val))
233+
t.Fatalf("value must be empty, got %s \n", val)
235234
}
236235
}
237236

@@ -265,10 +264,10 @@ func TestTurnToMappedColumnValue(t *testing.T) {
265264
t.Fatal("should NOT have found the column")
266265
}
267266
if col != "" {
268-
t.Fatal(fmt.Sprintf("column must be empty, got %s \n", col))
267+
t.Fatalf("column must be empty, got %s \n", col)
269268
}
270269
if val != "" {
271-
t.Fatal(fmt.Sprintf("value must be empty, got %s \n", val))
270+
t.Fatalf("value must be empty, got %s \n", val)
272271
}
273272
}
274273

0 commit comments

Comments
 (0)