File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,8 @@ var _ TB = (*B)(nil)
293
293
// may be called simultaneously from multiple goroutines.
294
294
type T struct {
295
295
common
296
- name string // Name of test.
296
+ name string // Name of test.
297
+ isParallel bool
297
298
startParallel chan bool // Parallel tests will wait on this.
298
299
}
299
300
@@ -430,6 +431,10 @@ func (t *T) Parallel() {
430
431
// We don't want to include the time we spend waiting for serial tests
431
432
// in the test duration. Record the elapsed time thus far and reset the
432
433
// timer afterwards.
434
+ if t .isParallel {
435
+ panic ("testing: t.Parallel called multiple times" )
436
+ }
437
+ t .isParallel = true
433
438
t .duration += time .Since (t .start )
434
439
t .signal <- (* T )(nil ) // Release main testing loop
435
440
<- t .startParallel // Wait for serial tests to finish
You can’t perform that action at this time.
0 commit comments