Text file src/cmd/go/testdata/script/test_chatty_fail.txt

     1  # Run chatty tests. Assert on CONT lines.
     2  ! go test chatty_test.go -v
     3  
     4  # Sanity check that output occurs.
     5  stdout -count=2 'this is sub-0'
     6  stdout -count=2 'this is sub-1'
     7  stdout -count=2 'this is sub-2'
     8  stdout -count=1 'error from sub-0'
     9  stdout -count=1 'error from sub-1'
    10  stdout -count=1 'error from sub-2'
    11  
    12  # Non-parallel tests should not print CONT.
    13  ! stdout CONT
    14  
    15  -- chatty_test.go --
    16  package chatty_test
    17  
    18  import (
    19  	"testing"
    20  	"fmt"
    21  )
    22  
    23  func TestChatty(t *testing.T) {
    24      for i := 0; i < 3; i++ {
    25          t.Run(fmt.Sprintf("sub-%d", i), func(t *testing.T) {
    26              for j := 0; j < 2; j++ {
    27                  t.Logf("this is sub-%d", i)
    28              }
    29              t.Errorf("error from sub-%d", i)
    30          })
    31      }
    32  }

View as plain text