...
1# Run chatty tests. Assert on CONT lines.
2go test chatty_test.go -v
3
4# Non-parallel tests should not print CONT.
5! stdout CONT
6
7# The assertion is condensed into one line so that it precisely matches output,
8# rather than skipping lines and allow rogue CONT lines.
9stdout '=== 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'
10
11-- chatty_test.go --
12package chatty_test
13
14import (
15 "testing"
16 "fmt"
17)
18
19func TestChatty(t *testing.T) {
20 for i := 0; i < 3; i++ {
21 t.Run(fmt.Sprintf("sub-%d", i), func(t *testing.T) {
22 for j := 0; j < 2; j++ {
23 t.Logf("this is sub-%d", i)
24 }
25 })
26 }
27}
View as plain text