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.
This commit is contained in:
Michael Albinus 2015-09-12 10:37:32 +02:00
parent 166812addb
commit fc9dc03290

View file

@ -39,9 +39,6 @@
(require 'filenotify)
(require 'tramp)
(declare-function tramp-get-remote-gvfs-monitor-dir "tramp-sh")
(declare-function tramp-get-remote-inotifywait "tramp-sh")
;; There is no default value on w32 systems, which could work out of the box.
(defconst file-notify-test-remote-temporary-file-directory
(cond
@ -140,22 +137,12 @@ being the result.")
"Test availability of `file-notify'."
(skip-unless (file-notify--test-local-enabled))
;; Report the native library which has been used.
(message
"%s library: `%s'"
(if (null (file-remote-p temporary-file-directory)) "Local" "Remote")
(if (null (file-remote-p temporary-file-directory))
file-notify--library
;; FIXME: This is rude, using Tramp internal functions. Maybe
;; the upcoming `file-notify-available-p' could return the used
;; native library.
(with-parsed-tramp-file-name temporary-file-directory nil
(cond
;; gvfs-monitor-dir.
((tramp-get-remote-gvfs-monitor-dir v) 'gfilenotify)
;; inotifywait.
((tramp-get-remote-inotifywait v) 'inotify)
;; None.
(t (ert-fail "No remote library available"))))))
(if (null (file-remote-p temporary-file-directory))
(message "Local library: `%s'" file-notify--library)
(message "Remote command: `%s'"
(replace-regexp-in-string
"<[[:digit:]]+>\\'" ""
(process-name (cdr file-notify--test-remote-enabled-checked)))))
(should
(setq file-notify--test-desc
(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."
(setq file-notify--test-events ,outer))))
(ert-deftest file-notify-test02-events ()
"Check file creation/removal notifications."
"Check file creation/change/removal notifications."
(skip-unless (file-notify--test-local-enabled))
(unwind-protect
(progn
@ -317,11 +304,12 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
(dolist (result file-notify--test-results)
;;(message "%s" (ert-test-result-messages result))
(when (ert-test-failed-p result)
(ert-fail (cadr (ert-test-result-with-condition-condition result))))))
(ert-fail
(cadr (ert-test-result-with-condition-condition result))))))
(file-notify--test-cleanup)))
(file-notify--deftest-remote file-notify-test02-events
"Check file creation/removal notifications for remote files.")
"Check file creation/change/removal notifications for remote files.")
(require 'autorevert)
(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
@ -371,8 +359,9 @@ This test is skipped in batch mode."
(with-current-buffer (get-buffer-create "*Messages*")
(file-notify--wait-for-events
timeout
(string-match (format "Reverting buffer `%s'." (buffer-name buf))
(buffer-string))))
(string-match
(format-message "Reverting buffer `%s'." (buffer-name buf))
(buffer-string))))
(should (string-match "another text" (buffer-string)))))
;; Exit.