...

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

Documentation: cmd/go/testdata/script

     1# Test that calling t.Fatal in a benchmark causes a non-zero exit status.
     2
     3! go test -run '^$' -bench . benchfatal
     4! stdout ^ok
     5! stderr ^ok
     6stdout FAIL.*benchfatal
     7
     8-- go.mod --
     9module benchfatal
    10
    11go 1.16
    12-- x_test.go --
    13package benchfatal
    14
    15import "testing"
    16
    17func BenchmarkThatCallsFatal(b *testing.B) {
    18	b.Fatal("called by benchmark")
    19}

View as plain text