| # 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) |
| } |
| }) |
| } |
| } |