bc4ac7ce04
fsnotify is needed by the new ocicni monitoring implementation. As ocicni switched to logrus, glog is no longer needed. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build !plan9
|
|
|
|
package fsnotify
|
|
|
|
import "testing"
|
|
|
|
func TestEventStringWithValue(t *testing.T) {
|
|
for opMask, expectedString := range map[Op]string{
|
|
Chmod | Create: `"/usr/someFile": CREATE|CHMOD`,
|
|
Rename: `"/usr/someFile": RENAME`,
|
|
Remove: `"/usr/someFile": REMOVE`,
|
|
Write | Chmod: `"/usr/someFile": WRITE|CHMOD`,
|
|
} {
|
|
event := Event{Name: "/usr/someFile", Op: opMask}
|
|
if event.String() != expectedString {
|
|
t.Fatalf("Expected %s, got: %v", expectedString, event.String())
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
func TestEventOpStringWithValue(t *testing.T) {
|
|
expectedOpString := "WRITE|CHMOD"
|
|
event := Event{Name: "someFile", Op: Write | Chmod}
|
|
if event.Op.String() != expectedOpString {
|
|
t.Fatalf("Expected %s, got: %v", expectedOpString, event.Op.String())
|
|
}
|
|
}
|
|
|
|
func TestEventOpStringWithNoValue(t *testing.T) {
|
|
expectedOpString := ""
|
|
event := Event{Name: "testFile", Op: 0}
|
|
if event.Op.String() != expectedOpString {
|
|
t.Fatalf("Expected %s, got: %v", expectedOpString, event.Op.String())
|
|
}
|
|
}
|