[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116096: * automated/file-notify-tests.el
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] trunk r116096: * automated/file-notify-tests.el |
Date: |
Tue, 21 Jan 2014 13:31:52 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116096
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Tue 2014-01-21 14:31:39 +0100
message:
* automated/file-notify-tests.el
(file-notify--test-local-enabled): Fix error in logic.
(file-notify--wait-for-events): New defmacro.
(file-notify-test02-events): Make short breaks between file operations.
Use `file-notify--wait-for-events'. Check, that events have arrived.
(file-notify-test03-autorevert): Use `file-notify--wait-for-events'.
modified:
test/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-8588
test/automated/file-notify-tests.el
filenotifytests.el-20130702144123-sxglvo6zs3jcj8w1-1
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2014-01-21 08:32:06 +0000
+++ b/test/ChangeLog 2014-01-21 13:31:39 +0000
@@ -1,5 +1,12 @@
2014-01-21 Michael Albinus <address@hidden>
+ * automated/file-notify-tests.el
+ (file-notify--test-local-enabled): Fix error in logic.
+ (file-notify--wait-for-events): New defmacro.
+ (file-notify-test02-events): Make short breaks between file operations.
+ Use `file-notify--wait-for-events'. Check, that events have arrived.
+ (file-notify-test03-autorevert): Use `file-notify--wait-for-events'.
+
* automated/comint-testsuite.el
(comint-testsuite-password-strings): Add localized examples.
=== modified file 'test/automated/file-notify-tests.el'
--- a/test/automated/file-notify-tests.el 2014-01-01 07:43:34 +0000
+++ b/test/automated/file-notify-tests.el 2014-01-21 13:31:39 +0000
@@ -67,7 +67,7 @@
This is needed for local `temporary-file-directory' only, in the
remote case we return always `t'."
(or file-notify--library
- (not (file-remote-p temporary-file-directory))))
+ (file-remote-p temporary-file-directory)))
(defvar file-notify--test-remote-enabled-checked nil
"Cached result of `file-notify--test-remote-enabled'.
@@ -187,6 +187,16 @@
(expand-file-name
(make-temp-name "file-notify-test") temporary-file-directory))
+(defmacro file-notify--wait-for-events (timeout until)
+ "Wait for file notification events until form UNTIL is true.
+TIMEOUT is the maximum time to wait for."
+ `(with-timeout (,timeout (ignore))
+ (while (null ,until)
+ ;; glib events, and remote events.
+ (accept-process-output nil 0.1)
+ ;; inotify events.
+ (read-event nil nil 0.1))))
+
(ert-deftest file-notify-test02-events ()
"Check file creation/removal notifications."
(skip-unless (file-notify--test-local-enabled))
@@ -205,6 +215,7 @@
(write-region
"any text" nil file-notify--test-tmpfile nil 'no-message)
(delete-file file-notify--test-tmpfile)
+ (sit-for 0.1 'nodisplay)
;; Check copy and rename.
(write-region
@@ -212,18 +223,21 @@
(copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
(delete-file file-notify--test-tmpfile)
(delete-file file-notify--test-tmpfile1)
+ (sit-for 0.1 'nodisplay)
(write-region
"any text" nil file-notify--test-tmpfile nil 'no-message)
(rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
- (delete-file file-notify--test-tmpfile1))
+ (delete-file file-notify--test-tmpfile1)
+ (sit-for 0.1 'nodisplay))
;; Wait for events, and exit.
- (sit-for 5 'nodisplay)
+ (file-notify--wait-for-events 5 file-notify--test-results)
(file-notify-rm-watch desc)
(ignore-errors (delete-file file-notify--test-tmpfile))
(ignore-errors (delete-file file-notify--test-tmpfile1))))
+ (should file-notify--test-results)
(dolist (result file-notify--test-results)
;(message "%s" (ert-test-result-messages result))
(when (ert-test-failed-p result)
@@ -278,14 +292,10 @@
;; Check, that the buffer has been reverted.
(with-current-buffer (get-buffer-create "*Messages*")
- (with-timeout (timeout (ignore))
- (while
- (null (string-match
- (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string)))
- ;; We must trigger the process filter to run.
- (when remote (accept-process-output nil 1))
- (sit-for 1 'nodisplay))))
+ (file-notify--wait-for-events
+ timeout
+ (string-match (format "Reverting buffer `%s'." (buffer-name buf))
+ (buffer-string))))
(should (string-match "another text" (buffer-string)))))
;; Exit.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116096: * automated/file-notify-tests.el,
Michael Albinus <=