From: Chris Howey Date: Mon, 17 Oct 2011 18:54:26 +0000 (-0700) Subject: Linux: formatting X-Git-Tag: v1.7.2~467 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=609d6d8dd868899cf4c78a23c4653fae0b76818a;p=fsnotify.git Linux: formatting --- diff --git a/fsnotify_linux.go b/fsnotify_linux.go index a99353c..abf84c2 100644 --- a/fsnotify_linux.go +++ b/fsnotify_linux.go @@ -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 diff --git a/fsnotify_test.go b/fsnotify_test.go index bc6ffe4..9acfd05 100644 --- a/fsnotify_test.go +++ b/fsnotify_test.go @@ -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()