aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2016-03-24 18:34:05 +0100
committerMichael Albinus2016-03-24 18:34:05 +0100
commitc8874e2113221a08252113b6d46ecc7066c62c8c (patch)
treed848068870790542f5a3d6a16f4d74b4d4d28a3c /test
parent39577d07124ee16895b9c6aab7e2c6e7d41cc715 (diff)
downloademacs-c8874e2113221a08252113b6d46ecc7066c62c8c.tar.gz
emacs-c8874e2113221a08252113b6d46ecc7066c62c8c.zip
Adapt filenotify-tests.el according latest tests
* test/lisp/filenotify-tests.el (file-notify-test02-events) (file-notify-test04-file-validity, file-notify-test05-dir-validity): Remove superfluous `read-event' calls. (file-notify-test02-events): Expect different events under MS Windows 7 and 10. (file-notify-test04-file-validity): Move `file-notify-valid-p' check up.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/filenotify-tests.el31
1 files changed, 10 insertions, 21 deletions
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 39088949b36..49a861d91a4 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -397,7 +397,6 @@ longer than timeout seconds for the events to be delivered."
397 '((changed deleted stopped) 397 '((changed deleted stopped)
398 (changed changed deleted stopped))) 398 (changed changed deleted stopped)))
399 (t '(changed changed deleted stopped))) 399 (t '(changed changed deleted stopped)))
400 (read-event nil nil file-notify--test-read-event-timeout)
401 (write-region 400 (write-region
402 "another text" nil file-notify--test-tmpfile nil 'no-message) 401 "another text" nil file-notify--test-tmpfile nil 'no-message)
403 (read-event nil nil file-notify--test-read-event-timeout) 402 (read-event nil nil file-notify--test-read-event-timeout)
@@ -429,12 +428,10 @@ longer than timeout seconds for the events to be delivered."
429 ((string-equal (file-notify--test-library) "kqueue") 428 ((string-equal (file-notify--test-library) "kqueue")
430 '(created changed deleted stopped)) 429 '(created changed deleted stopped))
431 (t '(created changed deleted deleted stopped))) 430 (t '(created changed deleted deleted stopped)))
432 (read-event nil nil file-notify--test-read-event-timeout)
433 (write-region 431 (write-region
434 "any text" nil file-notify--test-tmpfile nil 'no-message) 432 "any text" nil file-notify--test-tmpfile nil 'no-message)
435 (read-event nil nil file-notify--test-read-event-timeout) 433 (read-event nil nil file-notify--test-read-event-timeout)
436 (delete-directory temporary-file-directory 'recursive) 434 (delete-directory temporary-file-directory 'recursive))
437 (read-event nil nil file-notify--test-read-event-timeout))
438 (file-notify-rm-watch file-notify--test-desc)) 435 (file-notify-rm-watch file-notify--test-desc))
439 436
440 ;; Check copy of files inside a directory. 437 ;; Check copy of files inside a directory.
@@ -465,7 +462,6 @@ longer than timeout seconds for the events to be delivered."
465 '(created changed created changed deleted stopped)) 462 '(created changed created changed deleted stopped))
466 (t '(created changed created changed 463 (t '(created changed created changed
467 deleted deleted deleted stopped))) 464 deleted deleted deleted stopped)))
468 (read-event nil nil file-notify--test-read-event-timeout)
469 (write-region 465 (write-region
470 "any text" nil file-notify--test-tmpfile nil 'no-message) 466 "any text" nil file-notify--test-tmpfile nil 'no-message)
471 (read-event nil nil file-notify--test-read-event-timeout) 467 (read-event nil nil file-notify--test-read-event-timeout)
@@ -476,8 +472,7 @@ longer than timeout seconds for the events to be delivered."
476 (read-event nil nil file-notify--test-read-event-timeout) 472 (read-event nil nil file-notify--test-read-event-timeout)
477 (set-file-times file-notify--test-tmpfile '(0 0)) 473 (set-file-times file-notify--test-tmpfile '(0 0))
478 (read-event nil nil file-notify--test-read-event-timeout) 474 (read-event nil nil file-notify--test-read-event-timeout)
479 (delete-directory temporary-file-directory 'recursive) 475 (delete-directory temporary-file-directory 'recursive))
480 (read-event nil nil file-notify--test-read-event-timeout))
481 (file-notify-rm-watch file-notify--test-desc)) 476 (file-notify-rm-watch file-notify--test-desc))
482 477
483 ;; Check rename of files inside a directory. 478 ;; Check rename of files inside a directory.
@@ -504,15 +499,13 @@ longer than timeout seconds for the events to be delivered."
504 ((string-equal (file-notify--test-library) "kqueue") 499 ((string-equal (file-notify--test-library) "kqueue")
505 '(created changed renamed deleted stopped)) 500 '(created changed renamed deleted stopped))
506 (t '(created changed renamed deleted deleted stopped))) 501 (t '(created changed renamed deleted deleted stopped)))
507 (read-event nil nil file-notify--test-read-event-timeout)
508 (write-region 502 (write-region
509 "any text" nil file-notify--test-tmpfile nil 'no-message) 503 "any text" nil file-notify--test-tmpfile nil 'no-message)
510 (read-event nil nil file-notify--test-read-event-timeout) 504 (read-event nil nil file-notify--test-read-event-timeout)
511 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) 505 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
512 ;; After the rename, we won't get events anymore. 506 ;; After the rename, we won't get events anymore.
513 (read-event nil nil file-notify--test-read-event-timeout) 507 (read-event nil nil file-notify--test-read-event-timeout)
514 (delete-directory temporary-file-directory 'recursive) 508 (delete-directory temporary-file-directory 'recursive))
515 (read-event nil nil file-notify--test-read-event-timeout))
516 (file-notify-rm-watch file-notify--test-desc)) 509 (file-notify-rm-watch file-notify--test-desc))
517 510
518 ;; Check attribute change. Does not work for cygwin. 511 ;; Check attribute change. Does not work for cygwin.
@@ -528,16 +521,18 @@ longer than timeout seconds for the events to be delivered."
528 (file-notify--test-with-events 521 (file-notify--test-with-events
529 (cond 522 (cond
530 ;; w32notify does not distinguish between `changed' and 523 ;; w32notify does not distinguish between `changed' and
531 ;; `attribute-changed'. 524 ;; `attribute-changed'. Under MS Windows 7, we get
525 ;; four `changed' events, and under MS Windows 10 just
526 ;; two. Strange.
532 ((string-equal (file-notify--test-library) "w32notify") 527 ((string-equal (file-notify--test-library) "w32notify")
533 '(changed changed)) 528 '((changed changed)
529 (changed changed changed changed)))
534 ;; For kqueue and in the remote case, `write-region' 530 ;; For kqueue and in the remote case, `write-region'
535 ;; raises also an `attribute-changed' event. 531 ;; raises also an `attribute-changed' event.
536 ((or (string-equal (file-notify--test-library) "kqueue") 532 ((or (string-equal (file-notify--test-library) "kqueue")
537 (file-remote-p temporary-file-directory)) 533 (file-remote-p temporary-file-directory))
538 '(attribute-changed attribute-changed attribute-changed)) 534 '(attribute-changed attribute-changed attribute-changed))
539 (t '(attribute-changed attribute-changed))) 535 (t '(attribute-changed attribute-changed)))
540 (read-event nil nil file-notify--test-read-event-timeout)
541 (write-region 536 (write-region
542 "any text" nil file-notify--test-tmpfile nil 'no-message) 537 "any text" nil file-notify--test-tmpfile nil 'no-message)
543 (read-event nil nil file-notify--test-read-event-timeout) 538 (read-event nil nil file-notify--test-read-event-timeout)
@@ -673,6 +668,7 @@ longer than timeout seconds for the events to be delivered."
673 (file-notify-add-watch 668 (file-notify-add-watch
674 file-notify--test-tmpfile 669 file-notify--test-tmpfile
675 '(change) #'file-notify--test-event-handler))) 670 '(change) #'file-notify--test-event-handler)))
671 (should (file-notify-valid-p file-notify--test-desc))
676 (file-notify--test-with-events 672 (file-notify--test-with-events
677 (cond 673 (cond
678 ;; cygwin recognizes only `deleted' and `stopped' events. 674 ;; cygwin recognizes only `deleted' and `stopped' events.
@@ -688,8 +684,6 @@ longer than timeout seconds for the events to be delivered."
688 '((changed deleted stopped) 684 '((changed deleted stopped)
689 (changed changed deleted stopped))) 685 (changed changed deleted stopped)))
690 (t '(changed changed deleted stopped))) 686 (t '(changed changed deleted stopped)))
691 (should (file-notify-valid-p file-notify--test-desc))
692 (read-event nil nil file-notify--test-read-event-timeout)
693 (write-region 687 (write-region
694 "another text" nil file-notify--test-tmpfile nil 'no-message) 688 "another text" nil file-notify--test-tmpfile nil 'no-message)
695 (read-event nil nil file-notify--test-read-event-timeout) 689 (read-event nil nil file-notify--test-read-event-timeout)
@@ -710,6 +704,7 @@ longer than timeout seconds for the events to be delivered."
710 (file-notify-add-watch 704 (file-notify-add-watch
711 temporary-file-directory 705 temporary-file-directory
712 '(change) #'file-notify--test-event-handler))) 706 '(change) #'file-notify--test-event-handler)))
707 (should (file-notify-valid-p file-notify--test-desc))
713 (file-notify--test-with-events 708 (file-notify--test-with-events
714 (cond 709 (cond
715 ;; w32notify does not raise `deleted' and `stopped' events 710 ;; w32notify does not raise `deleted' and `stopped' events
@@ -724,8 +719,6 @@ longer than timeout seconds for the events to be delivered."
724 ((string-equal (file-notify--test-library) "kqueue") 719 ((string-equal (file-notify--test-library) "kqueue")
725 '(created changed deleted stopped)) 720 '(created changed deleted stopped))
726 (t '(created changed deleted deleted stopped))) 721 (t '(created changed deleted deleted stopped)))
727 (should (file-notify-valid-p file-notify--test-desc))
728 (read-event nil nil file-notify--test-read-event-timeout)
729 (write-region 722 (write-region
730 "any text" nil file-notify--test-tmpfile nil 'no-message) 723 "any text" nil file-notify--test-tmpfile nil 'no-message)
731 (read-event nil nil file-notify--test-read-event-timeout) 724 (read-event nil nil file-notify--test-read-event-timeout)
@@ -757,9 +750,7 @@ longer than timeout seconds for the events to be delivered."
757 (should (file-notify-valid-p file-notify--test-desc)) 750 (should (file-notify-valid-p file-notify--test-desc))
758 ;; After removing the watch, the descriptor must not be valid 751 ;; After removing the watch, the descriptor must not be valid
759 ;; anymore. 752 ;; anymore.
760 (read-event nil nil file-notify--test-read-event-timeout)
761 (file-notify-rm-watch file-notify--test-desc) 753 (file-notify-rm-watch file-notify--test-desc)
762 (read-event nil nil file-notify--test-read-event-timeout)
763 (file-notify--wait-for-events 754 (file-notify--wait-for-events
764 (file-notify--test-timeout) 755 (file-notify--test-timeout)
765 (not (file-notify-valid-p file-notify--test-desc))) 756 (not (file-notify-valid-p file-notify--test-desc)))
@@ -781,9 +772,7 @@ longer than timeout seconds for the events to be delivered."
781 (should (file-notify-valid-p file-notify--test-desc)) 772 (should (file-notify-valid-p file-notify--test-desc))
782 ;; After deleting the directory, the descriptor must not be 773 ;; After deleting the directory, the descriptor must not be
783 ;; valid anymore. 774 ;; valid anymore.
784 (read-event nil nil file-notify--test-read-event-timeout)
785 (delete-directory file-notify--test-tmpfile t) 775 (delete-directory file-notify--test-tmpfile t)
786 (read-event nil nil file-notify--test-read-event-timeout)
787 (file-notify--wait-for-events 776 (file-notify--wait-for-events
788 (file-notify--test-timeout) 777 (file-notify--test-timeout)
789 (not (file-notify-valid-p file-notify--test-desc))) 778 (not (file-notify-valid-p file-notify--test-desc)))