Skip to content

Commit

Permalink
Report assert errors as t.Error (#628)
Browse files Browse the repository at this point in the history
Internal assert package returns booleans for allowing conditional
behaviour but currently can't be used as `t.Fatal` is called suspending
execution. It's also not safe for `t.Fatal` to be called outside of the
main go routine running the test. Use `t.Error` to report errors
instead.
  • Loading branch information
emcfarlane authored Nov 7, 2023
1 parent 2be1555 commit 20b5723
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/assert/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func report(tb testing.TB, got, want any, desc string, showWant bool, options ..
if showWant {
fmt.Fprintf(buffer, "want:\t%+v\n", want)
}
tb.Fatal(buffer.String())
tb.Error(buffer.String())
}

func isNil(got any) bool {
Expand Down

0 comments on commit 20b5723

Please sign in to comment.