]> go.fuhry.dev Git - fsnotify.git/commitdiff
Linux: formatting
authorChris Howey <chris@howey.me>
Mon, 17 Oct 2011 18:54:26 +0000 (11:54 -0700)
committerChris Howey <chris@howey.me>
Mon, 17 Oct 2011 18:54:26 +0000 (11:54 -0700)
fsnotify_linux.go
fsnotify_test.go

index a99353c092967fe3e7ec9e96d0a8b350a5289cad..abf84c273deb06a4b8542f7223afadee10f7ce36 100644 (file)
@@ -268,7 +268,7 @@ const (
        IN_MOVE_SELF     uint32 = syscall.IN_MOVE_SELF
        IN_OPEN          uint32 = syscall.IN_OPEN
 
-       OS_AGNOSTIC_EVENTS = IN_ATTRIB | IN_MODIFY | IN_MOVE_SELF | IN_DELETE
+       OS_AGNOSTIC_EVENTS = IN_CREATE | IN_ATTRIB | IN_MODIFY | IN_MOVE_SELF | IN_DELETE
 
        // Special events
        IN_ISDIR      uint32 = syscall.IN_ISDIR
index bc6ffe4b5c6f704cf11e4798dc4852ec8e17054b..9acfd05b554e1673a762254d791fd036e0aed694 100644 (file)
@@ -17,7 +17,7 @@ func TestFsnotifyEvents(t *testing.T) {
                t.Fatalf("NewWatcher() failed: %s", err)
        }
 
-    const testDir string = "_test"
+       const testDir string = "_test"
 
        // Add a watch for testDir
        err = watcher.Watch(testDir)
@@ -53,12 +53,12 @@ func TestFsnotifyEvents(t *testing.T) {
 
        // Create a file
        // This should add at least one event to the fsnotify event queue
-    var f *os.File
+       var f *os.File
        f, err = os.OpenFile(testFile, os.O_WRONLY|os.O_CREATE, 0666)
        if err != nil {
                t.Fatalf("creating test file failed: %s", err)
        }
-    f.Sync()
+       f.Sync()
 
        // Add a watch for testFile
        err = watcher.Watch(testFile)
@@ -66,11 +66,11 @@ func TestFsnotifyEvents(t *testing.T) {
                t.Fatalf("Watcher.Watch() failed: %s", err)
        }
 
-    f.WriteString("data")
-    f.Sync()
-    f.Close()
+       f.WriteString("data")
+       f.Sync()
+       f.Close()
 
-    os.Remove(testFile)
+       os.Remove(testFile)
 
        // We expect this event to be received almost immediately, but let's wait 500 ms to be sure
        time.Sleep(500e6) // 500 ms
@@ -78,6 +78,8 @@ func TestFsnotifyEvents(t *testing.T) {
                t.Fatal("fsnotify event hasn't been received after 500 ms")
        }
 
+       t.Logf("Received %d events.", eventsReceived)
+
        // Try closing the fsnotify instance
        t.Log("calling Close()")
        watcher.Close()