emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 20ff1b5: Adapt file-notify-test02-events test case


From: Michael Albinus
Subject: [Emacs-diffs] master 20ff1b5: Adapt file-notify-test02-events test case
Date: Wed, 23 Sep 2015 20:25:09 +0000

branch: master
commit 20ff1b5cd96a548376fd7f70fa1da5c0060849cd
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Adapt file-notify-test02-events test case
    
    * test/automated/file-notify-tests.el (file-notify-test02-events):
    Create a new watch for every test.
---
 test/automated/file-notify-tests.el |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/test/automated/file-notify-tests.el 
b/test/automated/file-notify-tests.el
index 569f946..03946dd 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -264,22 +264,26 @@ Don't wait longer than TIMEOUT seconds for the events to 
be delivered."
   (skip-unless (file-notify--test-local-enabled))
   (unwind-protect
       (progn
+        ;; Check creation, change, and deletion.
         (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
               file-notify--test-tmpfile1 (file-notify--test-make-temp-name)
               file-notify--test-desc
               (file-notify-add-watch
                file-notify--test-tmpfile
                '(change) 'file-notify--test-event-handler))
-        (should file-notify--test-desc)
-
-        ;; Check creation, change, and deletion.
         (file-notify--test-with-events
             (file-notify--test-timeout) '(created changed deleted)
           (write-region
            "any text" nil file-notify--test-tmpfile nil 'no-message)
           (delete-file file-notify--test-tmpfile))
+        (file-notify-rm-watch file-notify--test-desc)
 
         ;; Check copy.
+        (setq file-notify--test-desc
+              (file-notify-add-watch
+               file-notify--test-tmpfile
+               '(change) 'file-notify--test-event-handler))
+        (should file-notify--test-desc)
         (file-notify--test-with-events
             (file-notify--test-timeout)
             ;; w32notify does not distinguish between `changed' and
@@ -296,8 +300,14 @@ Don't wait longer than TIMEOUT seconds for the events to 
be delivered."
           (set-file-times file-notify--test-tmpfile '(0 0))
           (delete-file file-notify--test-tmpfile)
           (delete-file file-notify--test-tmpfile1))
+        (file-notify-rm-watch file-notify--test-desc)
 
         ;; Check rename.
+        (setq file-notify--test-desc
+              (file-notify-add-watch
+               file-notify--test-tmpfile
+               '(change) 'file-notify--test-event-handler))
+        (should file-notify--test-desc)
         (file-notify--test-with-events
             (file-notify--test-timeout) '(created changed renamed)
           (write-region
@@ -305,10 +315,10 @@ Don't wait longer than TIMEOUT seconds for the events to 
be delivered."
           (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
           ;; After the rename, we won't get events anymore.
           (delete-file file-notify--test-tmpfile1))
+        (file-notify-rm-watch file-notify--test-desc)
 
         ;; Check attribute change.  It doesn't work for w32notify.
         (unless (eq file-notify--library 'w32notify)
-          (file-notify-rm-watch file-notify--test-desc)
           (setq file-notify--test-desc
                 (file-notify-add-watch
                  file-notify--test-tmpfile
@@ -320,7 +330,8 @@ Don't wait longer than TIMEOUT seconds for the events to be 
delivered."
             (set-file-modes file-notify--test-tmpfile 000)
             (read-event nil nil 0.1) ; In order to distinguish the events.
             (set-file-times file-notify--test-tmpfile '(0 0))
-            (delete-file file-notify--test-tmpfile)))
+            (delete-file file-notify--test-tmpfile))
+          (file-notify-rm-watch file-notify--test-desc))
 
         ;; Check the global sequence again just to make sure that
         ;; `file-notify--test-events' has been set correctly.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]