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.
5 // +build darwin linux freebsd dragonfly netbsd openbsd windows solaris
11 func TestNotifyExample(t *testing.T) {
12 n := NewNotifyTest(t, "testdata/vfs.txt")
17 // Watch-points can be set explicitly via Watch/Stop calls...
18 n.Watch("src/github.com/rjeczalik/fs", ch[0], Write)
19 n.Watch("src/github.com/pblaszczyk/qttu", ch[0], Write)
20 n.Watch("src/github.com/pblaszczyk/qttu/...", ch[1], Create)
21 n.Watch("src/github.com/rjeczalik/fs/cmd/...", ch[2], Remove)
26 Event: write(n.W(), "src/github.com/rjeczalik/fs/fs.go", []byte("XD")),
27 Receiver: Chans{ch[0]},
29 // TODO(rjeczalik): #62
32 // Event: write(n.W(), "src/github.com/pblaszczyk/qttu/README.md", []byte("XD")),
33 // Receiver: Chans{ch[0]},
37 Event: write(n.W(), "src/github.com/rjeczalik/fs/cmd/gotree/go.go", []byte("XD")),
42 Event: create(n.W(), "src/github.com/pblaszczyk/qttu/src/.main.cc.swp"),
43 Receiver: Chans{ch[1]},
47 Event: create(n.W(), "src/github.com/pblaszczyk/qttu/src/.main.cc.swo"),
48 Receiver: Chans{ch[1]},
52 Event: remove(n.W(), "src/github.com/rjeczalik/fs/cmd/gotree/go.go"),
53 Receiver: Chans{ch[2]},
57 n.ExpectNotifyEvents(cases, ch)
59 // ...or using Call structures.
78 Event: write(n.W(), "src/github.com/rjeczalik/fs/fs.go", []byte("XD")),
83 Event: write(n.W(), "src/github.com/pblaszczyk/qttu/README.md", []byte("XD")),
88 Event: create(n.W(), "src/github.com/pblaszczyk/qttu/src/.main.cc.swr"),
93 Event: remove(n.W(), "src/github.com/rjeczalik/fs/cmd/gotree/main.go"),
94 Receiver: Chans{ch[2]},
98 n.ExpectNotifyEvents(cases, ch)
101 func TestStop(t *testing.T) {
102 t.Skip("TODO(rjeczalik)")