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

     1  [short] skip
     2  
     3  env GOCACHE=$WORK/tmp
     4  go test -v multimain
     5  stdout -count=2 notwithstanding # check tests ran twice
     6  
     7  -- go.mod --
     8  module multimain
     9  
    10  go 1.16
    11  -- multimain_test.go --
    12  package multimain_test
    13  
    14  import "testing"
    15  
    16  func TestMain(m *testing.M) {
    17  	// Some users run m.Run multiple times, changing
    18  	// some kind of global state between runs.
    19  	// This used to work so I guess now it has to keep working.
    20  	// See golang.org/issue/23129.
    21  	m.Run()
    22  	m.Run()
    23  }
    24  
    25  func Test(t *testing.T) {
    26  	t.Log("notwithstanding")
    27  }
    28  

View as plain text