...

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

Documentation: cmd/go/testdata/script

     1[short] skip
     2
     3env GOCACHE=$WORK/tmp
     4go test -v multimain
     5stdout -count=2 notwithstanding # check tests ran twice
     6
     7-- go.mod --
     8module multimain
     9
    10go 1.16
    11-- multimain_test.go --
    12package multimain_test
    13
    14import "testing"
    15
    16func 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
    25func Test(t *testing.T) {
    26	t.Log("notwithstanding")
    27}

View as plain text