(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
"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)))
(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
(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"
(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.