From 126f21b0028e69f21bc3411f15bcaa80c25a24ff Mon Sep 17 00:00:00 2001 From: Michael Hendricks Date: Fri, 23 Apr 2021 18:38:02 -0600 Subject: [PATCH] Make sure failed tests report their exit code (#240) Commit 72c1660c13cb8cf0d590d91fb03625a68e53900f introduced TestMain, but forgot to call os.Exit with the value returned from m.Run This causes "go test" to exit with status 0, even if tests fail. Adding os.Exit to TestMain makes sure the success/failure of tests is correctly reported through the exit code. --- quick_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_test.go b/quick_test.go index da8b2e3c2..13cd1fe26 100644 --- a/quick_test.go +++ b/quick_test.go @@ -34,7 +34,7 @@ func TestMain(m *testing.M) { fmt.Fprintln(os.Stderr, "seed:", qseed) fmt.Fprintf(os.Stderr, "quick settings: count=%v, items=%v, ksize=%v, vsize=%v\n", qcount, qmaxitems, qmaxksize, qmaxvsize) - m.Run() + os.Exit(m.Run()) } func qconfig() *quick.Config {