File: clean_test.go

package info (click to toggle)
golang-github-smallstep-cli 0.15.16%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,404 kB
  • sloc: sh: 512; makefile: 99
file content (26 lines) | stat: -rw-r--r-- 376 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package x509util

import (
	"io/ioutil"
	"log"
	"os"
	"testing"
)

func TestMain(m *testing.M) {
	// discard log output when testing
	log.SetOutput(ioutil.Discard)

	result := m.Run()

	clean := func(files []string) {
		for _, f := range files {
			if _, err := os.Stat(f); !os.IsNotExist(err) {
				os.Remove(f)
			}
		}
	}
	clean([]string{"./test.crt"})

	os.Exit(result)
}