| 1 | package x509util |
| 2 | |
| 3 | import ( |
| 4 | "io/ioutil" |
| 5 | "log" |
| 6 | "os" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func TestMain(m *testing.M) { |
| 11 | // discard log output when testing |
| 12 | log.SetOutput(ioutil.Discard) |
| 13 | |
| 14 | result := m.Run() |
| 15 | |
| 16 | clean := func(files []string) { |
| 17 | for _, f := range files { |
| 18 | if _, err := os.Stat(f); !os.IsNotExist(err) { |
| 19 | os.Remove(f) |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | clean([]string{"./test.crt"}) |
| 24 | |
| 25 | os.Exit(result) |
| 26 | } |