aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/test_chatty_success.txt
blob: 8bfa569f807fd4a95ad35aaa9be0bff7be7f3651 (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
26
27
# Run chatty tests. Assert on CONT lines.
go test chatty_test.go -v

# Non-parallel tests should not print CONT.
! stdout CONT

# The assertion is condensed into one line so that it precisely matches output,
# rather than skipping lines and allow rogue CONT lines.
stdout '=== RUN   TestChatty\n=== RUN   TestChatty/sub-0\n    chatty_test.go:12: this is sub-0\n    chatty_test.go:12: this is sub-0\n=== RUN   TestChatty/sub-1\n    chatty_test.go:12: this is sub-1\n    chatty_test.go:12: this is sub-1\n=== RUN   TestChatty/sub-2\n    chatty_test.go:12: this is sub-2\n    chatty_test.go:12: this is sub-2\n--- PASS: TestChatty'

-- chatty_test.go --
package chatty_test

import (
	"testing"
	"fmt"
)

func TestChatty(t *testing.T) {
    for i := 0; i < 3; i++ {
        t.Run(fmt.Sprintf("sub-%d", i), func(t *testing.T) {
            for j := 0; j < 2; j++ {
                t.Logf("this is sub-%d", i)
            }
        })
    }
}