-
Notifications
You must be signed in to change notification settings - Fork 5
/
event_test.go
48 lines (43 loc) · 1.01 KB
/
event_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package gonotify
import (
"strings"
"testing"
)
// TestInotifyEvent_Is tests the Is function of InotifyEvent
func TestInotifyEvent_Is(t *testing.T) {
var i InotifyEvent
i.Mask = IN_ACCESS
if !i.Is(IN_ACCESS) {
t.Fail()
}
}
// TestInotifyEvent_IsAny tests the IsAny function of InotifyEvent
func TestInotifyEvent_IsAny(t *testing.T) {
var i InotifyEvent
i.Mask = IN_ACCESS
if !i.IsAny(IN_ACCESS, IN_ATTRIB) {
t.Fail()
}
}
// TestInotifyEvent_IsAll tests the IsAll function of InotifyEvent
func TestInotifyEvent_IsAll(t *testing.T) {
var i InotifyEvent
i.Mask = IN_ACCESS | IN_ATTRIB
if !i.IsAll(IN_ACCESS, IN_ATTRIB) {
t.Fail()
}
}
// TestInotifyEvent_String tests the String function of InotifyEvent
func TestInotifyEvent_String(t *testing.T) {
var i InotifyEvent
i.Mask = IN_ACCESS | IN_ATTRIB | IN_CLOSE_WRITE
if !strings.Contains(i.String(), "IN_ACCESS") {
t.Fail()
}
if !strings.Contains(i.String(), "IN_ATTRIB") {
t.Fail()
}
if !strings.Contains(i.String(), "IN_CLOSE_WRITE") {
t.Fail()
}
}