1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-24 16:54:00 +00:00

Improve test

This commit is contained in:
Alexander Neumann 2017-09-10 15:20:26 +02:00
parent 2fdca5d310
commit 47ddd34266

View file

@ -2,9 +2,10 @@ package main
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/restic/restic/internal/test"
)
func TestIsExcludedByFile(t *testing.T) {
@ -29,13 +30,11 @@ func TestIsExcludedByFile(t *testing.T) {
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
tempDir, err := ioutil.TempDir("", "restic-test-")
if err != nil {
t.Fatalf("could not create temp dir: %v", err)
}
defer os.RemoveAll(tempDir)
tempDir, cleanup := test.TempDir(t)
defer cleanup()
foo := filepath.Join(tempDir, "foo")
err = ioutil.WriteFile(foo, []byte("foo"), 0666)
err := ioutil.WriteFile(foo, []byte("foo"), 0666)
if err != nil {
t.Fatalf("could not write file: %v", err)
}