blob: 4eb97945ef68f0dc671e7119d247806f6fbab41c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
[short] skip
# go test -parallel -1 shouldn't work
! go test -parallel -1 standalone_parallel_sub_test.go
stdout '-parallel can only be given'
# go test -parallel 0 shouldn't work
! go test -parallel 0 standalone_parallel_sub_test.go
stdout '-parallel can only be given'
-- standalone_parallel_sub_test.go --
package standalone_parallel_sub_test
import "testing"
func Test(t *testing.T) {
ch := make(chan bool, 1)
t.Run("Sub", func(t *testing.T) {
t.Parallel()
<-ch
t.Run("Nested", func(t *testing.T) {})
})
// Ensures that Sub will finish after its t.Run call already returned.
ch <- true
}
|