...

Text file src/cmd/go/testdata/script/test_parallel_number.txt

Documentation: cmd/go/testdata/script

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

View as plain text