|
|
|
|
|
by marwatk
1304 days ago
|
|
I've read the assertions section a few times and I still don't understand the argument. How is: if got == nil {
t.Errorf("blog post was nil, want not-nil")
}
Better than assert.NotNil(t, got, "blog post")
? They seem to suggest that you lose context, but their "Good" examples are similarly devoid of context. |
|
For example for a simple string comparison it's 12 lines:
vs. 2 lines with a "normal" test: With your NotNil() example it's 4 lines, which seems about 3 lines more than needed.This kind of stuff really adds up if you have maybe 3 or 4 test failures.