template / ci-testing / files / main_test.go
Branch ci-testing · default branch · all branches
main_test.go
| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestMain(m *testing.M) { |
| 9 | setup() |
| 10 | code := m.Run() |
| 11 | shutdown() |
| 12 | os.Exit(code) |
| 13 | } |
| 14 | |
| 15 | func setup() { |
| 16 | // setup code |
| 17 | } |
| 18 | func shutdown() { |
| 19 | // shutdown code |
| 20 | |
| 21 | // not really necessary, but why not? |
| 22 | undoMonkeyPatch() |
| 23 | } |