Skip to content

Commit f26c131

Browse files
committed
testing: note FailNow does not prevent Cleanup functions
FailNow's documentation is fairly detailed about the way it causes execution to stop, and what runs after it has been called. However, from the Cleanup documentation it is not clear if functions registered with it would meet this criteria. Add an explicit note to clarify.
1 parent f215a0b commit f26c131

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/testing/testing.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ func (c *common) Failed() bool {
970970

971971
// FailNow marks the function as having failed and stops its execution
972972
// by calling runtime.Goexit (which then runs all deferred calls in the
973-
// current goroutine).
973+
// current goroutine, as well as ones registered with Cleanup for the current test or benchmark).
974974
// Execution will continue at the next test or benchmark.
975975
// FailNow must be called from the goroutine running the
976976
// test or benchmark function, not from other goroutines

0 commit comments

Comments
 (0)