1 // Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
2 // Use of this source code is governed by the MIT license that can be
3 // found in the LICENSE file.
11 // TODO(ppknap) : remove notify.Create event.
12 func rcreate(w *W, path string) WCase {
13 cas := create(w, path)
14 cas.Events = append(cas.Events,
15 &Call{P: path, E: FileActionAdded},
20 // TODO(ppknap) : remove notify.Remove event.
21 func rremove(w *W, path string) WCase {
22 cas := remove(w, path)
23 cas.Events = append(cas.Events,
24 &Call{P: path, E: FileActionRemoved},
29 // TODO(ppknap) : remove notify.Rename event.
30 func rrename(w *W, oldpath, newpath string) WCase {
31 cas := rename(w, oldpath, newpath)
32 cas.Events = append(cas.Events,
33 &Call{P: oldpath, E: FileActionRenamedOldName},
34 &Call{P: newpath, E: FileActionRenamedNewName},
39 // TODO(ppknap) : remove notify.Write event.
40 func rwrite(w *W, path string, p []byte) WCase {
41 cas := write(w, path, p)
42 cas.Events = append(cas.Events,
43 &Call{P: path, E: FileActionModified},
49 FileNotifyChangeFileName,
50 FileNotifyChangeDirName,
54 func TestWatcherReadDirectoryChangesW(t *testing.T) {
55 w := NewWatcherTest(t, "testdata/vfs.txt", events...)
59 rcreate(w, "src/github.com/rjeczalik/fs/fs_windows.go"),
60 rcreate(w, "src/github.com/rjeczalik/fs/subdir/"),
61 rremove(w, "src/github.com/rjeczalik/fs/fs.go"),
62 rrename(w, "src/github.com/rjeczalik/fs/LICENSE", "src/github.com/rjeczalik/fs/COPYLEFT"),
63 rwrite(w, "src/github.com/rjeczalik/fs/cmd/gotree/go.go", []byte("XD")),