Text file
src/cmd/go/testdata/script/test_chatty_parallel_success_run.txt
1 # Run parallel chatty tests. Assert on CONT or NAME lines. This test makes sure that
2 # multiple parallel outputs have the appropriate CONT lines between them.
3 go test -parallel 3 chatty_parallel -v
4
5 stdout '=== RUN TestInterruptor/interruption\n=== (CONT|NAME) TestLog\n chatty_parallel_test.go:28: this is the second TestLog log\n--- PASS: Test(Log|Interruptor) \([0-9.]{4}s\)'
6
7 -- go.mod --
8 module chatty_parallel
9
10 go 1.18
11 -- chatty_parallel_test.go --
12 package chatty_parallel_test
13
14 import (
15 "testing"
16 )
17
18 var (
19 afterFirstLog = make(chan struct{})
20 afterSubTest = make(chan struct{})
21 afterSecondLog = make(chan struct{})
22 )
23
24 func TestInterruptor(t *testing.T) {
25 t.Parallel()
26
27 <-afterFirstLog
28 t.Run("interruption", func (t *testing.T) {})
29 close(afterSubTest)
30 <-afterSecondLog // Delay the "PASS: TestInterruptor" line until after "CONT TestLog".
31 }
32
33 func TestLog(t *testing.T) {
34 t.Parallel()
35
36 t.Logf("this is the first TestLog log")
37 close(afterFirstLog)
38 <-afterSubTest
39 t.Logf("this is the second TestLog log")
40 close(afterSecondLog)
41 }
42
View as plain text