...

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

Documentation: cmd/go/testdata/script

     1# Matches only subtests, parallel
     2go test -run Test/Sub/Nested standalone_parallel_sub_test.go
     3! stdout '^ok.*\[no tests to run\]'
     4! stderr '^ok.*\[no tests to run\]'
     5stdout '^ok'
     6
     7-- standalone_parallel_sub_test.go --
     8package standalone_parallel_sub_test
     9
    10import "testing"
    11
    12func Test(t *testing.T) {
    13	ch := make(chan bool, 1)
    14	t.Run("Sub", func(t *testing.T) {
    15		t.Parallel()
    16		<-ch
    17		t.Run("Nested", func(t *testing.T) {})
    18	})
    19	// Ensures that Sub will finish after its t.Run call already returned.
    20	ch <- true
    21}

View as plain text