mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
Adapt file-notify-test02-events test case
* test/automated/file-notify-tests.el (file-notify-test02-events): Create a new watch for every test.
This commit is contained in:
parent
8c3c506aa5
commit
20ff1b5cd9
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user