-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
require
to assert
to avoid calls to t.FailNow and ensure t…
…hat assertions will run inside goroutines concurrently safely. Note that `go vet` will wanr about use of t.FailNow inside goroutines, but not if nested inside functions. Co-authored-by: Kevin Intriago <[email protected]>
- Loading branch information
1 parent
da708b9
commit 72d51ac
Showing
3 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package test | ||
|
||
import "testing" | ||
|
||
func TestFatal(t *testing.T) { | ||
go func() { | ||
t.Fatal("oops") // This exits the inner func instead of TestFoo. | ||
}() | ||
} | ||
|
||
func TestFatal2(t *testing.T) { | ||
go func() { | ||
fatal(t) // This should raise a vet warning but does not. | ||
}() | ||
} | ||
|
||
func fatal(t *testing.T) { | ||
t.Fatal("oops") // This exits the inner func instead of TestFoo. | ||
} | ||
|