]> go.fuhry.dev Git - fsnotify.git/commitdiff
tests: Allow resetting the value of a counter
authorAdrien Bustany <adrien@bustany.org>
Thu, 16 Jan 2014 16:43:46 +0000 (17:43 +0100)
committerAdrien Bustany <adrien@bustany.org>
Thu, 16 Jan 2014 17:08:02 +0000 (18:08 +0100)
This is useful when you want to check the event count delta after doing
some operations.

fsnotify_test.go

index 8f1b1aebcdf10fc30aef5b9117ee1539dd0894d5..fdb66b66246b5ad8cb019c66e500023ff87819b7 100644 (file)
@@ -45,6 +45,10 @@ func (c *counter) value() int32 {
        return atomic.LoadInt32(&c.val)
 }
 
+func (c *counter) reset() {
+       atomic.StoreInt32(&c.val, 0)
+}
+
 func TestFsnotifyMultipleOperations(t *testing.T) {
        // Create an fsnotify watcher instance and initialize it
        watcher, err := NewWatcher()