| # Run chatty tests. Assert on CONT lines. |
| ! go test chatty_test.go -v |
| |
| # Sanity check that output occurs. |
| stdout -count=2 'this is sub-0' |
| stdout -count=2 'this is sub-1' |
| stdout -count=2 'this is sub-2' |
| stdout -count=1 'error from sub-0' |
| stdout -count=1 'error from sub-1' |
| stdout -count=1 'error from sub-2' |
| |
| # Non-parallel tests should not print CONT. |
| ! stdout CONT |
| |
| -- 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) |
| } |
| t.Errorf("error from sub-%d", i) |
| }) |
| } |
| } |