aboutsummaryrefslogtreecommitdiff
path: root/src/testing/sub_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2017-01-18 00:05:32 -0500
committerJoe Tsai <thebrokentoaster@gmail.com>2017-01-18 07:44:24 +0000
commitd10eddcba3e2cc90a822d80e7162f74501141eb8 (patch)
tree4127e56d95458ce44b2dcabb57c6f6603cd1b989 /src/testing/sub_test.go
parent2c8b70eacfc3fd2d86bd8e4e4764f11a2e9b3deb (diff)
downloadgo-d10eddcba3e2cc90a822d80e7162f74501141eb8.tar.xz
testing: make parallel t.Run safe again
Fixes #18603. Change-Id: I5760c0a9f862200b7e943058a672eb559ac1b9d9 Reviewed-on: https://go-review.googlesource.com/35354 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/testing/sub_test.go')
-rw-r--r--src/testing/sub_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go
index 8d5d9206f0..bb7b3e0925 100644
--- a/src/testing/sub_test.go
+++ b/src/testing/sub_test.go
@@ -6,6 +6,7 @@ package testing
import (
"bytes"
+ "fmt"
"regexp"
"strings"
"sync/atomic"
@@ -515,3 +516,19 @@ func TestBenchmarkOutput(t *T) {
Benchmark(func(b *B) { b.Error("do not print this output") })
Benchmark(func(b *B) {})
}
+
+func TestParallelSub(t *T) {
+ c := make(chan int)
+ block := make(chan int)
+ for i := 0; i < 10; i++ {
+ go func(i int) {
+ <-block
+ t.Run(fmt.Sprint(i), func(t *T) {})
+ c <- 1
+ }(i)
+ }
+ close(block)
+ for i := 0; i < 10; i++ {
+ <-c
+ }
+}