|
|
|
|
|
by alpb
3225 days ago
|
|
t.Helper() is certainly going to be very useful. I often implement functions like: func testServer(t *testing.T, port int) {
...do stuff...
if err != nil { t.Fatalf("failed to start server: %+v", err) }
}
similarly you can have func assertMapEquals(t *testing.T, a, b map[string]int)
It lets you hide such helper methods from the test failure's stack trace (where t.Fatal is actually called), making test errors more readable. |
|