Joe
Joe

Reputation: 47619

How to assert with a debug message in Go tests?

I want to do this:

test.FailNow("My Message")

but test.T.FailNow doesn't take a message. I am currently doing:

log.Println("Expected exception but got none")
test.FailNow()

Is there a better way?

Upvotes: 5

Views: 1100

Answers (1)

zzzz
zzzz

Reputation: 91253

See: http://golang.org/pkg/testing/#T.Fatal (and Fatalf)

The docs say: "Fatal is equivalent to Log() followed by FailNow()."

Upvotes: 9

Related Questions