aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2015-09-14 09:52:31 +0200
committerTassilo Horn2015-09-14 09:52:56 +0200
commitf60fca1aa3256def9192021f95711cde6f65749e (patch)
tree3ade2ef3bb8ca90ae4754dd5428b48c13d537f8f
parentef5b1a22bbeef239981dd6745abb4f08e2de54e0 (diff)
downloademacs-f60fca1aa3256def9192021f95711cde6f65749e.tar.gz
emacs-f60fca1aa3256def9192021f95711cde6f65749e.zip
Fix tests for file-notify-valid-p.
-rw-r--r--test/automated/file-notify-tests.el46
1 files changed, 26 insertions, 20 deletions
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 3ade9980d6b..caf9316daa9 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -68,10 +68,14 @@
68 68
69 (when (and file-notify--test-tmpfile 69 (when (and file-notify--test-tmpfile
70 (file-exists-p file-notify--test-tmpfile)) 70 (file-exists-p file-notify--test-tmpfile))
71 (delete-file file-notify--test-tmpfile)) 71 (if (directory-name-p file-notify--test-tmpfile)
72 (delete-directory file-notify--test-tmpfile)
73 (delete-file file-notify--test-tmpfile)))
72 (when (and file-notify--test-tmpfile1 74 (when (and file-notify--test-tmpfile1
73 (file-exists-p file-notify--test-tmpfile1)) 75 (file-exists-p file-notify--test-tmpfile1))
74 (delete-file file-notify--test-tmpfile1)) 76 (if (directory-name-p file-notify--test-tmpfile1)
77 (delete-directory file-notify--test-tmpfile1)
78 (delete-file file-notify--test-tmpfile1)))
75 79
76 (setq file-notify--test-tmpfile nil) 80 (setq file-notify--test-tmpfile nil)
77 (setq file-notify--test-tmpfile1 nil) 81 (setq file-notify--test-tmpfile1 nil)
@@ -376,7 +380,8 @@ This test is skipped in batch mode.")
376 "Check `file-notify-valid-p'." 380 "Check `file-notify-valid-p'."
377 (skip-unless (file-notify--test-local-enabled)) 381 (skip-unless (file-notify--test-local-enabled))
378 (unwind-protect 382 (unwind-protect
379 (progn 383 (let ((temporary-file-directory (make-temp-file
384 "file-notify-test-parent" t)))
380 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) 385 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
381 (setq file-notify--test-desc (file-notify-add-watch 386 (setq file-notify--test-desc (file-notify-add-watch
382 file-notify--test-tmpfile 387 file-notify--test-tmpfile
@@ -391,13 +396,14 @@ This test is skipped in batch mode.")
391 (write-region 396 (write-region
392 "any text" nil file-notify--test-tmpfile nil 'no-message) 397 "any text" nil file-notify--test-tmpfile nil 'no-message)
393 (should (file-notify-valid-p file-notify--test-desc)) 398 (should (file-notify-valid-p file-notify--test-desc))
394 (delete-file file-notify--test-tmpfile) 399 (delete-directory temporary-file-directory t)
395 ;; TODO: Even after deletion, the descriptor stays valid. 400 ;; After deleting the parent, the descriptor must not be
396 ;; Is that intended? 401 ;; valid anymore.
397 (should (file-notify-valid-p file-notify--test-desc)))) 402 (should (not (file-notify-valid-p file-notify--test-desc)))))
398 403
399 ;; Exit. 404 ;; Exit.
400 (file-notify--test-cleanup))) 405 (ignore-errors
406 (file-notify--test-cleanup))))
401 407
402(file-notify--deftest-remote file-notify-test04-file-validity 408(file-notify--deftest-remote file-notify-test04-file-validity
403 "Check `file-notify-valid-p' via file notification for remote 409 "Check `file-notify-valid-p' via file notification for remote
@@ -407,25 +413,25 @@ files.")
407 "Check `file-notify-valid-p' for directories." 413 "Check `file-notify-valid-p' for directories."
408 (skip-unless (file-notify--test-local-enabled)) 414 (skip-unless (file-notify--test-local-enabled))
409 (unwind-protect 415 (unwind-protect
410 (progn 416 (let ((temporary-file-directory (make-temp-file
411 (setq dir (file-name-as-directory 417 "file-notify-test-parent" t)))
412 (file-notify--test-make-temp-name))) 418 (setq file-notify--test-tmpfile (file-name-as-directory
413 (make-directory dir) 419 (file-notify--test-make-temp-name)))
420 (make-directory file-notify--test-tmpfile)
414 (setq file-notify--test-desc (file-notify-add-watch 421 (setq file-notify--test-desc (file-notify-add-watch
415 dir 422 file-notify--test-tmpfile
416 '(change) 423 '(change)
417 #'file-notify--test-event-handler)) 424 #'file-notify--test-event-handler))
418 425
419 (should (file-notify-valid-p file-notify--test-desc)) 426 (should (file-notify-valid-p file-notify--test-desc))
420 (delete-directory dir) 427 (delete-directory temporary-file-directory t)
421 ;; TODO: Even after deletion, the descriptor stays valid. Is 428 ;; After deleting the parent, the descriptor must not be
422 ;; that intended? 429 ;; valid anymore.
423 (should (file-notify-valid-p file-notify--test-desc))) 430 (should (not (file-notify-valid-p file-notify--test-desc))))
424 431
425 ;; FIXME: This signals an exception which indicates that 432 ;; Exit.
426 ;; file-notify--test-desc shouldn't really be valid anymore.
427 (ignore-errors 433 (ignore-errors
428 (file-notify-rm-watch file-notify--test-desc)))) 434 (file-notify--test-cleanup))))
429 435
430(file-notify--deftest-remote file-notify-test05-dir-validity 436(file-notify--deftest-remote file-notify-test05-dir-validity
431 "Check `file-notify-valid-p' via file notification for remote 437 "Check `file-notify-valid-p' via file notification for remote