github.com/misseven0/notify@v0.0.0-20230519123055-c1422e46da05/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 //go:build windows 6 // +build windows 7 8 package notify 9 10 import "testing" 11 12 func TestNotifySystemSpecificEvent(t *testing.T) { 13 n := NewNotifyTest(t, "testdata/vfs.txt") 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 36 ch := NewChans(1) 37 38 n.WatchErr("src/github.com/rjeczalik/fs", ch[0], nil, FileActionAdded) 39 } 40 41 func TestNotifySystemAndGlobalMix(t *testing.T) { 42 n := NewNotifyTest(t, "testdata/vfs.txt") 43 44 ch := NewChans(3) 45 46 n.Watch("src/github.com/rjeczalik/fs", ch[0], Create) 47 n.Watch("src/github.com/rjeczalik/fs", ch[1], FileNotifyChangeFileName) 48 n.Watch("src/github.com/rjeczalik/fs", ch[2], FileNotifyChangeDirName) 49 50 cases := []NCase{ 51 { 52 Event: rcreate(n.W(), "src/github.com/rjeczalik/fs/.main.cc.swr"), 53 Receiver: Chans{ch[0], ch[1]}, 54 }, 55 } 56 57 n.ExpectNotifyEvents(cases, ch) 58 }