mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-10-04 04:31:00 +00:00
test: use t.TempDir
This was added in Go 1.15 and avoids polluting the host /tmp with test directories if the test crashes or is forcefully killed. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
parent
d997335f30
commit
f2b48a0e2f
5 changed files with 13 additions and 62 deletions
|
@ -72,11 +72,7 @@ func (fs *MockFsEval) KeywordFunc(fn KeywordFunc) KeywordFunc {
|
|||
|
||||
//gocyclo:ignore
|
||||
func TestCheckFsEval(t *testing.T) {
|
||||
dir, err := os.MkdirTemp("", "test-check-fs-eval")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll(dir) // clean up
|
||||
dir := t.TempDir()
|
||||
|
||||
content := []byte("If you hide your ignorance, no one will hit you and you'll never learn.")
|
||||
tmpfn := filepath.Join(dir, "tmpfile")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue