Skip to content

Commit

Permalink
test: Use t.Logf instead of fmt.Printf
Browse files Browse the repository at this point in the history
t.Logf is quiet unless a test fails or -v is used. It also keeps the log
messages grouped with the test names nicely.
  • Loading branch information
mmlb committed Mar 23, 2022
1 parent afea6a7 commit ee3d6bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func _assert(t *testing.T, condition bool, msg string, v ...interface{}) {

if !condition {
_, file, line, _ := runtime.Caller(2)
fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
t.Logf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
t.FailNow()
}
}
Expand Down

0 comments on commit ee3d6bd

Please sign in to comment.