-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readdcw: add tests for system-dependent events
- Loading branch information
Pawel Knap
committed
Feb 13, 2015
1 parent
721cfe0
commit b504320
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// +build windows | ||
|
||
package notify | ||
|
||
import "testing" | ||
|
||
func TestNotifySystemAndGlobalMix(t *testing.T) { | ||
t.Skip("TODO(ppknap)") | ||
n := NewNotifyTest(t, "testdata/vfs.txt") | ||
defer n.Close() | ||
|
||
ch := NewChans(2) | ||
|
||
n.Watch("src/github.com/rjeczalik/fs", ch[0], Create) | ||
n.Watch("src/github.com/rjeczalik/fs", ch[1], FileActionAdded) | ||
|
||
cases := []NCase{ | ||
{ | ||
Event: rcreate(n.W(), "src/github.com/rjeczalik/fs/.main.cc.swr"), | ||
Receiver: Chans{ch[0], ch[1]}, | ||
}, | ||
} | ||
|
||
n.ExpectNotifyEvents(cases, ch) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// +build windows | ||
|
||
package notify | ||
|
||
import "testing" | ||
|
||
// rcreate TODO | ||
func rcreate(w *W, path string) WCase { | ||
cas := create(w, path) | ||
cas.Events = append(cas.Events, | ||
&Call{P: path, E: FileActionAdded}, | ||
) | ||
return cas | ||
} | ||
|
||
// rremove TODO | ||
func rremove(w *W, path string) WCase { | ||
cas := remove(w, path) | ||
cas.Events = append(cas.Events, | ||
&Call{P: path, E: FileActionRemoved}, | ||
) | ||
return cas | ||
} | ||
|
||
// rrename TODO | ||
func rrename(w *W, oldpath, newpath string) WCase { | ||
cas := rename(w, oldpath, newpath) | ||
cas.Events = append(cas.Events, | ||
&Call{P: oldpath, E: FileActionRenamedOldName}, | ||
&Call{P: newpath, E: FileActionRenamedNewName}, | ||
) | ||
return cas | ||
} | ||
|
||
var events = []Event{ | ||
FileNotifyChangeFileName, | ||
FileNotifyChangeDirName, | ||
} | ||
|
||
func TestWatcherReadDirectoryChangesW(t *testing.T) { | ||
w := NewWatcherTest(t, "testdata/vfs.txt", events...) | ||
defer w.Close() | ||
|
||
cases := [...]WCase{ | ||
rcreate(w, "src/github.com/rjeczalik/fs/fs_windows.go"), | ||
rcreate(w, "src/github.com/rjeczalik/fs/subdir/"), | ||
rremove(w, "src/github.com/rjeczalik/fs/fs.go"), | ||
rrename(w, "src/github.com/rjeczalik/fs/LICENSE", "src/github.com/rjeczalik/fs/COPYLEFT"), | ||
} | ||
|
||
w.ExpectAny(cases[:]) | ||
} |