-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented event.IsAny(mask, ...), IsAll(mask, ...), Is(mask) to mak…
…e it easier for the end customer
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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() | ||
} | ||
} |