diff options
| author | Michael Albinus | 2015-09-23 22:25:02 +0200 |
|---|---|---|
| committer | Michael Albinus | 2015-09-23 22:25:02 +0200 |
| commit | 20ff1b5cd96a548376fd7f70fa1da5c0060849cd (patch) | |
| tree | 6ca2b5106b49076d96bf194c65cf1ffb1e22e9a0 | |
| parent | 8c3c506aa52b96bac8a24ebfd81f403fcfe0228d (diff) | |
| download | emacs-20ff1b5cd96a548376fd7f70fa1da5c0060849cd.tar.gz emacs-20ff1b5cd96a548376fd7f70fa1da5c0060849cd.zip | |
Adapt file-notify-test02-events test case
* test/automated/file-notify-tests.el (file-notify-test02-events):
Create a new watch for every test.
| -rw-r--r-- | 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 569f94643c2..03946dd8acf 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." | |||
| 264 | (skip-unless (file-notify--test-local-enabled)) | 264 | (skip-unless (file-notify--test-local-enabled)) |
| 265 | (unwind-protect | 265 | (unwind-protect |
| 266 | (progn | 266 | (progn |
| 267 | ;; Check creation, change, and deletion. | ||
| 267 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) | 268 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) |
| 268 | file-notify--test-tmpfile1 (file-notify--test-make-temp-name) | 269 | file-notify--test-tmpfile1 (file-notify--test-make-temp-name) |
| 269 | file-notify--test-desc | 270 | file-notify--test-desc |
| 270 | (file-notify-add-watch | 271 | (file-notify-add-watch |
| 271 | file-notify--test-tmpfile | 272 | file-notify--test-tmpfile |
| 272 | '(change) 'file-notify--test-event-handler)) | 273 | '(change) 'file-notify--test-event-handler)) |
| 273 | (should file-notify--test-desc) | ||
| 274 | |||
| 275 | ;; Check creation, change, and deletion. | ||
| 276 | (file-notify--test-with-events | 274 | (file-notify--test-with-events |
| 277 | (file-notify--test-timeout) '(created changed deleted) | 275 | (file-notify--test-timeout) '(created changed deleted) |
| 278 | (write-region | 276 | (write-region |
| 279 | "any text" nil file-notify--test-tmpfile nil 'no-message) | 277 | "any text" nil file-notify--test-tmpfile nil 'no-message) |
| 280 | (delete-file file-notify--test-tmpfile)) | 278 | (delete-file file-notify--test-tmpfile)) |
| 279 | (file-notify-rm-watch file-notify--test-desc) | ||
| 281 | 280 | ||
| 282 | ;; Check copy. | 281 | ;; Check copy. |
| 282 | (setq file-notify--test-desc | ||
| 283 | (file-notify-add-watch | ||
| 284 | file-notify--test-tmpfile | ||
| 285 | '(change) 'file-notify--test-event-handler)) | ||
| 286 | (should file-notify--test-desc) | ||
| 283 | (file-notify--test-with-events | 287 | (file-notify--test-with-events |
| 284 | (file-notify--test-timeout) | 288 | (file-notify--test-timeout) |
| 285 | ;; w32notify does not distinguish between `changed' and | 289 | ;; w32notify does not distinguish between `changed' and |
| @@ -296,8 +300,14 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." | |||
| 296 | (set-file-times file-notify--test-tmpfile '(0 0)) | 300 | (set-file-times file-notify--test-tmpfile '(0 0)) |
| 297 | (delete-file file-notify--test-tmpfile) | 301 | (delete-file file-notify--test-tmpfile) |
| 298 | (delete-file file-notify--test-tmpfile1)) | 302 | (delete-file file-notify--test-tmpfile1)) |
| 303 | (file-notify-rm-watch file-notify--test-desc) | ||
| 299 | 304 | ||
| 300 | ;; Check rename. | 305 | ;; Check rename. |
| 306 | (setq file-notify--test-desc | ||
| 307 | (file-notify-add-watch | ||
| 308 | file-notify--test-tmpfile | ||
| 309 | '(change) 'file-notify--test-event-handler)) | ||
| 310 | (should file-notify--test-desc) | ||
| 301 | (file-notify--test-with-events | 311 | (file-notify--test-with-events |
| 302 | (file-notify--test-timeout) '(created changed renamed) | 312 | (file-notify--test-timeout) '(created changed renamed) |
| 303 | (write-region | 313 | (write-region |
| @@ -305,10 +315,10 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." | |||
| 305 | (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) | 315 | (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) |
| 306 | ;; After the rename, we won't get events anymore. | 316 | ;; After the rename, we won't get events anymore. |
| 307 | (delete-file file-notify--test-tmpfile1)) | 317 | (delete-file file-notify--test-tmpfile1)) |
| 318 | (file-notify-rm-watch file-notify--test-desc) | ||
| 308 | 319 | ||
| 309 | ;; Check attribute change. It doesn't work for w32notify. | 320 | ;; Check attribute change. It doesn't work for w32notify. |
| 310 | (unless (eq file-notify--library 'w32notify) | 321 | (unless (eq file-notify--library 'w32notify) |
| 311 | (file-notify-rm-watch file-notify--test-desc) | ||
| 312 | (setq file-notify--test-desc | 322 | (setq file-notify--test-desc |
| 313 | (file-notify-add-watch | 323 | (file-notify-add-watch |
| 314 | file-notify--test-tmpfile | 324 | file-notify--test-tmpfile |
| @@ -320,7 +330,8 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." | |||
| 320 | (set-file-modes file-notify--test-tmpfile 000) | 330 | (set-file-modes file-notify--test-tmpfile 000) |
| 321 | (read-event nil nil 0.1) ; In order to distinguish the events. | 331 | (read-event nil nil 0.1) ; In order to distinguish the events. |
| 322 | (set-file-times file-notify--test-tmpfile '(0 0)) | 332 | (set-file-times file-notify--test-tmpfile '(0 0)) |
| 323 | (delete-file file-notify--test-tmpfile))) | 333 | (delete-file file-notify--test-tmpfile)) |
| 334 | (file-notify-rm-watch file-notify--test-desc)) | ||
| 324 | 335 | ||
| 325 | ;; Check the global sequence again just to make sure that | 336 | ;; Check the global sequence again just to make sure that |
| 326 | ;; `file-notify--test-events' has been set correctly. | 337 | ;; `file-notify--test-events' has been set correctly. |