-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_test.go
36 lines (27 loc) · 1021 Bytes
/
setup_test.go
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
27
28
29
30
31
32
33
34
35
36
//go:build !windows && !plan9 && !netbsd && !aix && !illumos && !solaris && !js
// +build !windows,!plan9,!netbsd,!aix,!illumos,!solaris,!js
package aferocopy
import (
"os"
"syscall"
"testing"
"github.com/spf13/afero"
)
func setup(*testing.M) {
fs := afero.NewOsFs()
ignore(fs.Remove("resources/fixtures/data/case11/foo/bar"))
ignore(fs.Remove("resources/fixtures/data/case03/case01"))
must(fs.MkdirAll("resources/test/data.copy", os.ModePerm))
must(fs.Chmod("resources/fixtures/data/case07/dir_0555", 0o555))
must(fs.Chmod("resources/fixtures/data/case07/file_0444", 0o444))
must(syscall.Mkfifo("resources/fixtures/data/case11/foo/bar", 0o555))
if fs, ok := fs.(afero.Linker); ok {
must(fs.SymlinkIfPossible("resources/fixtures/data/case01", "resources/fixtures/data/case03/case01"))
}
}
func teardown(*testing.M) {
fs := afero.NewOsFs()
must(fs.RemoveAll("resources/test"))
must(fs.Remove("resources/fixtures/data/case11/foo/bar"))
must(fs.Remove("resources/fixtures/data/case03/case01"))
}