aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2015-09-12 10:37:32 +0200
committerMichael Albinus2015-09-12 10:37:32 +0200
commitfc9dc032906d840f63d29fbdcfd25e36ca3451b8 (patch)
treedd1c1a4f2173fe71c4dbf6258847e8f7e54c8a72
parent166812addb0a1b9b2258ef3ce76424cd7facfa8b (diff)
downloademacs-fc9dc032906d840f63d29fbdcfd25e36ca3451b8.tar.gz
emacs-fc9dc032906d840f63d29fbdcfd25e36ca3451b8.zip
Fix tests in file-notify-tests.el
* test/automated/file-notify-tests.el: Remove Tramp declarations. (file-notify-test00-availability): Print remote command w/o Tramp internal functions. (file-notify-test02-events, file-notify-test02-events-remote): Adapt docstring. (file-notify-test03-autorevert): Use `format-message' when inspecting *Messages* buffer.
-rw-r--r--test/automated/file-notify-tests.el37
1 files changed, 13 insertions, 24 deletions
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 99b0ebc9283..18e1b939a72 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -39,9 +39,6 @@
39(require 'filenotify) 39(require 'filenotify)
40(require 'tramp) 40(require 'tramp)
41 41
42(declare-function tramp-get-remote-gvfs-monitor-dir "tramp-sh")
43(declare-function tramp-get-remote-inotifywait "tramp-sh")
44
45;; There is no default value on w32 systems, which could work out of the box. 42;; There is no default value on w32 systems, which could work out of the box.
46(defconst file-notify-test-remote-temporary-file-directory 43(defconst file-notify-test-remote-temporary-file-directory
47 (cond 44 (cond
@@ -140,22 +137,12 @@ being the result.")
140 "Test availability of `file-notify'." 137 "Test availability of `file-notify'."
141 (skip-unless (file-notify--test-local-enabled)) 138 (skip-unless (file-notify--test-local-enabled))
142 ;; Report the native library which has been used. 139 ;; Report the native library which has been used.
143 (message 140 (if (null (file-remote-p temporary-file-directory))
144 "%s library: `%s'" 141 (message "Local library: `%s'" file-notify--library)
145 (if (null (file-remote-p temporary-file-directory)) "Local" "Remote") 142 (message "Remote command: `%s'"
146 (if (null (file-remote-p temporary-file-directory)) 143 (replace-regexp-in-string
147 file-notify--library 144 "<[[:digit:]]+>\\'" ""
148 ;; FIXME: This is rude, using Tramp internal functions. Maybe 145 (process-name (cdr file-notify--test-remote-enabled-checked)))))
149 ;; the upcoming `file-notify-available-p' could return the used
150 ;; native library.
151 (with-parsed-tramp-file-name temporary-file-directory nil
152 (cond
153 ;; gvfs-monitor-dir.
154 ((tramp-get-remote-gvfs-monitor-dir v) 'gfilenotify)
155 ;; inotifywait.
156 ((tramp-get-remote-inotifywait v) 'inotify)
157 ;; None.
158 (t (ert-fail "No remote library available"))))))
159 (should 146 (should
160 (setq file-notify--test-desc 147 (setq file-notify--test-desc
161 (file-notify-add-watch temporary-file-directory '(change) 'ignore))) 148 (file-notify-add-watch temporary-file-directory '(change) 'ignore)))
@@ -261,7 +248,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
261 (setq file-notify--test-events ,outer)))) 248 (setq file-notify--test-events ,outer))))
262 249
263(ert-deftest file-notify-test02-events () 250(ert-deftest file-notify-test02-events ()
264 "Check file creation/removal notifications." 251 "Check file creation/change/removal notifications."
265 (skip-unless (file-notify--test-local-enabled)) 252 (skip-unless (file-notify--test-local-enabled))
266 (unwind-protect 253 (unwind-protect
267 (progn 254 (progn
@@ -317,11 +304,12 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
317 (dolist (result file-notify--test-results) 304 (dolist (result file-notify--test-results)
318 ;;(message "%s" (ert-test-result-messages result)) 305 ;;(message "%s" (ert-test-result-messages result))
319 (when (ert-test-failed-p result) 306 (when (ert-test-failed-p result)
320 (ert-fail (cadr (ert-test-result-with-condition-condition result)))))) 307 (ert-fail
308 (cadr (ert-test-result-with-condition-condition result))))))
321 (file-notify--test-cleanup))) 309 (file-notify--test-cleanup)))
322 310
323(file-notify--deftest-remote file-notify-test02-events 311(file-notify--deftest-remote file-notify-test02-events
324 "Check file creation/removal notifications for remote files.") 312 "Check file creation/change/removal notifications for remote files.")
325 313
326(require 'autorevert) 314(require 'autorevert)
327(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" 315(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
@@ -371,8 +359,9 @@ This test is skipped in batch mode."
371 (with-current-buffer (get-buffer-create "*Messages*") 359 (with-current-buffer (get-buffer-create "*Messages*")
372 (file-notify--wait-for-events 360 (file-notify--wait-for-events
373 timeout 361 timeout
374 (string-match (format "Reverting buffer `%s'." (buffer-name buf)) 362 (string-match
375 (buffer-string)))) 363 (format-message "Reverting buffer `%s'." (buffer-name buf))
364 (buffer-string))))
376 (should (string-match "another text" (buffer-string))))) 365 (should (string-match "another text" (buffer-string)))))
377 366
378 ;; Exit. 367 ;; Exit.