File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ import (
1313
1414// TestMain takes care of the test setup for this package.
1515func TestMain (m * testing.M ) {
16+ os .Exit (runTests (m ))
17+ }
18+
19+ func runTests (m * testing.M ) int {
1620 // Always remove the DB after running tests
1721 defer os .Remove ("data/gorm.db" )
1822
@@ -152,6 +156,5 @@ func TestMain(m *testing.M) {
152156
153157 models .DB .Create (& waterBillTransactionMar )
154158
155- code := m .Run ()
156- os .Exit (code )
159+ return m .Run ()
157160}
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ import (
1111
1212// TestMain takes care of the test setup for this package.
1313func TestMain (m * testing.M ) {
14+ os .Exit (runTests (m ))
15+ }
16+
17+ func runTests (m * testing.M ) int {
1418 // Always remove the DB after running tests
1519 defer os .Remove ("data/gorm.db" )
1620
@@ -24,6 +28,5 @@ func TestMain(m *testing.M) {
2428 log .Fatalf ("Database migration failed with: %s" , err .Error ())
2529 }
2630
27- code := m .Run ()
28- os .Exit (code )
31+ return m .Run ()
2932}
You can’t perform that action at this time.
0 commit comments