// # Windows-specific test.
// windows:
// WRITE path
+//
+// You can specify multiple platforms with a comma (e.g. "windows, linux:").
+// "kqueue" is a shortcut for all kqueue systems (BSD, macOS).
func newEvents(t *testing.T, s string) Events {
t.Helper()
var (
lines = strings.Split(s, "\n")
- group string
+ groups = []string{""}
events = make(map[string]Events)
)
for no, line := range lines {
continue
}
if strings.HasSuffix(line, ":") {
- group = strings.TrimRight(line, ":")
+ groups = strings.Split(strings.TrimRight(line, ":"), ",")
+ for i := range groups {
+ groups[i] = strings.TrimSpace(groups[i])
+ }
continue
}
}
}
}
- events[group] = append(events[group], Event{Name: path, Op: op})
+
+ for _, g := range groups {
+ events[g] = append(events[g], Event{Name: path, Op: op})
+ }
}
if e, ok := events[runtime.GOOS]; ok {
}
func TestWatchSymlink(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skip("symlinks don't work on Windows")
- }
-
tests := []testCase{
{"create unresolvable symlink", func(t *testing.T, w *Watcher, tmp string) {
addWatch(t, w, tmp)
symlink(t, filepath.Join(tmp, "target"), tmp, "link")
}, `
create /link
+
+ windows:
+ create /link
+ write /link
`},
{"cyclic symlink", func(t *testing.T, w *Watcher, tmp string) {
write /link
create /link
- linux:
+ linux, windows:
remove /link
create /link
write /link