github.com/checksum/notify@v0.0.0-20190119234841-59aa2d88664f/notify_readdcw_test.go (about) 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. 4 5 // +build windows 6 7 package notify 8 9 import "testing" 10 11 func TestNotifySystemSpecificEvent(t *testing.T) { 12 n := NewNotifyTest(t, "testdata/vfs.txt") 13 defer n.Close() 14 15 ch := NewChans(1) 16 17 n.Watch("src/github.com/rjeczalik/fs", ch[0], FileNotifyChangeFileName, FileNotifyChangeSize) 18 19 cases := []NCase{ 20 { 21 Event: rremove(n.W(), "src/github.com/rjeczalik/fs/fs.go"), 22 Receiver: Chans{ch[0]}, 23 }, 24 { 25 Event: rwrite(n.W(), "src/github.com/rjeczalik/fs/README.md", []byte("XD")), 26 Receiver: Chans{ch[0]}, 27 }, 28 } 29 30 n.ExpectNotifyEvents(cases, ch) 31 } 32 33 func TestUnknownEvent(t *testing.T) { 34 n := NewNotifyTest(t, "testdata/vfs.txt") 35 defer n.Close() 36 37 ch := NewChans(1) 38 39 n.WatchErr("src/github.com/rjeczalik/fs", ch[0], nil, FileActionAdded) 40 } 41 42 func TestNotifySystemAndGlobalMix(t *testing.T) { 43 n := NewNotifyTest(t, "testdata/vfs.txt") 44 defer n.Close() 45 46 ch := NewChans(3) 47 48 n.Watch("src/github.com/rjeczalik/fs", ch[0], Create) 49 n.Watch("src/github.com/rjeczalik/fs", ch[1], FileNotifyChangeFileName) 50 n.Watch("src/github.com/rjeczalik/fs", ch[2], FileNotifyChangeDirName) 51 52 cases := []NCase{ 53 { 54 Event: rcreate(n.W(), "src/github.com/rjeczalik/fs/.main.cc.swr"), 55 Receiver: Chans{ch[0], ch[1]}, 56 }, 57 } 58 59 n.ExpectNotifyEvents(cases, ch) 60 }