aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 686e77029a..12e2a8e692 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -731,6 +731,10 @@ func tRunner(t *T, fn func(t *T)) {
// a call to runtime.Goexit, record the duration and send
// a signal saying that the test is done.
defer func() {
+ if t.failed {
+ atomic.AddUint32(&numFailed, 1)
+ }
+
if t.raceErrors+race.Errors() > 0 {
t.Errorf("race detected during execution of test")
}
@@ -790,9 +794,7 @@ func tRunner(t *T, fn func(t *T)) {
t.raceErrors = -race.Errors()
fn(t)
- if t.failed {
- atomic.AddUint32(&numFailed, 1)
- }
+ // code beyond here will not be executed when FailNow is invoked
t.finished = true
}