Skip to content

Commit 4c4dc8e

Browse files
committed
Fixes error code on test run
`TestMain` is used for all tests, not just benchmarks as it looks like the file might expect. The error code was being ignored which results in an `ok` status on each test run even when there are failures. This commit fixes `TestMain` to return the error code returned from `Run()`. I did not look at anything else going on in the file.
1 parent fb99b89 commit 4c4dc8e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

parse_bench_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ func benchmarkParseLargeConfig(b *testing.B, sz int) {
9292
}
9393
}
9494

95-
func TestMain(b *testing.M) {
96-
b.Run()
95+
func TestMain(m *testing.M) {
96+
code := m.Run()
9797
if rm != nil {
9898
rm()
9999
}
100-
os.Exit(0)
100+
os.Exit(code)
101101
}
102102

103103
func BenchmarkParseLargeConfig_Slow_TokBuf_0(b *testing.B) { benchmarkParseLargeConfig(b, 0) }

0 commit comments

Comments
 (0)