OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / rjeczalik / notify / notify_inotify_test.go
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 linux
6
7 package notify
8
9 import "testing"
10
11 func TestNotifySystemAndGlobalMix(t *testing.T) {
12         n := NewNotifyTest(t, "testdata/vfs.txt")
13         defer n.Close()
14
15         ch := NewChans(2)
16
17         n.Watch("src/github.com/rjeczalik/fs", ch[0], Create)
18         n.Watch("src/github.com/rjeczalik/fs", ch[1], InCreate)
19
20         cases := []NCase{
21                 {
22                         Event:    icreate(n.W(), "src/github.com/rjeczalik/fs/.main.cc.swr"),
23                         Receiver: Chans{ch[0], ch[1]},
24                 },
25         }
26
27         n.ExpectNotifyEvents(cases, ch)
28 }
29
30 func TestUnknownEvent(t *testing.T) {
31         n := NewNotifyTest(t, "testdata/vfs.txt")
32         defer n.Close()
33
34         ch := NewChans(1)
35
36         n.WatchErr("src/github.com/rjeczalik/fs", ch[0], nil, inExclUnlink)
37 }