You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect testing.T.FailNow() to cleanly fail a test, including terminating any running
goroutines, and the main routine if it was called in a goroutine.
Running `go test` with the attached file, I expect to see "I'm about to fail",
followed by the test cleanly failing.
Instead I see:
$ go test
I'm about to fail
I'm about to loop forever
and the process never terminates.
This also happens if the infinite loop is in the main thread.
If rather than looping forever, a channel is being waited on, I get a deadlock panic.
If I remove the time.Sleep from the test, the test will pass, and then loop forever!
Which operating system are you using?
Mac OSX 10.6.8 x64
Which version are you using? (run 'go version')
$ go version
go version go1.0.2
i don't think it is pkg testing's responsibility to kill all goroutines (maybe they are
useful anyway)
when a test fails
and the test itself is supposed to manage its goroutines.
t.FailNow is an error if called from a different goroutine. That should be documented
well. Also, it would be great if t.FailNow could panic in that case. However, I am not
sure we can catch that.
by dawagner:
Attachments:
The text was updated successfully, but these errors were encountered: