emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113528: * automated/file-notify-tests.el


From: Michael Albinus
Subject: [Emacs-diffs] trunk r113528: * automated/file-notify-tests.el
Date: Wed, 24 Jul 2013 13:56:56 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113528
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Wed 2013-07-24 15:56:19 +0200
message:
  * automated/file-notify-tests.el
  (file-notify--test-local-enabled): New defconst.  Replaces all
  `file-notify-support' occurences.
  (file-notify--test-remote-enabled): New defun.
  (file-notify--deftest-remote): Use it.
  (file-notify-test00-availability): Rewrite.
  (file-notify-test00-availability-remote): New defun.
  (file-notify-test01-add-watch): Rewrite first erroneous check.
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    2013-07-23 19:54:01 +0000
+++ b/test/ChangeLog    2013-07-24 13:56:19 +0000
@@ -1,3 +1,14 @@
+2013-07-24  Michael Albinus  <address@hidden>
+
+       * automated/file-notify-tests.el
+       (file-notify--test-local-enabled): New defconst.  Replaces all
+       `file-notify-support' occurences.
+       (file-notify--test-remote-enabled): New defun.
+       (file-notify--deftest-remote): Use it.
+       (file-notify-test00-availability): Rewrite.
+       (file-notify-test00-availability-remote): New defun.
+       (file-notify-test01-add-watch): Rewrite first erroneous check.
+
 2013-07-23  Glenn Morris  <address@hidden>
 
        * automated/inotify-test.el (inotify-file-watch-simple):

=== modified file 'test/automated/file-notify-tests.el'
--- a/test/automated/file-notify-tests.el       2013-07-09 07:52:25 +0000
+++ b/test/automated/file-notify-tests.el       2013-07-24 13:56:19 +0000
@@ -47,13 +47,21 @@
       tramp-message-show-message nil)
 (when noninteractive (defalias 'tramp-read-passwd 'ignore))
 
+;; We do not want to try and fail `file-notify-add-watch'.
+(defconst file-notify--test-local-enabled file-notify--library
+  "Whether local file notification is enabled.")
+
+;; We need also a check on the remote side, w/o adding a file monitor.
+(defun file-notify--test-remote-enabled ()
+  "Whether remote file notification is enabled."
+  (ignore-errors
+    (and (file-remote-p file-notify-test-remote-temporary-file-directory)
+        (file-directory-p file-notify-test-remote-temporary-file-directory)
+        (file-writable-p file-notify-test-remote-temporary-file-directory))))
+
 (defmacro file-notify--deftest-remote (test docstring)
   "Define ert `TEST-remote' for remote files."
-  `(when (ignore-errors
-          (and
-           (file-remote-p file-notify-test-remote-temporary-file-directory)
-           (file-directory-p file-notify-test-remote-temporary-file-directory)
-           (file-writable-p file-notify-test-remote-temporary-file-directory)))
+  `(when (and (file-notify--test-remote-enabled) (ert-get-test ',test))
      ;; Define the test.
      (ert-deftest ,(intern (concat (symbol-name test) "-remote")) ()
        ,docstring
@@ -77,10 +85,16 @@
 
 (ert-deftest file-notify-test00-availability ()
   "Test availability of `file-notify'."
-  :expected-result (if file-notify-support :passed :failed)
-  (should (memq file-notify-support '(gfilenotify inotify w32notify))))
-
-(when file-notify-support
+  (let (desc)
+    ;; Check, that different valid parameters are accepted.
+    (should (setq desc (file-notify-add-watch
+                       temporary-file-directory '(change) 'ignore)))
+    (file-notify-rm-watch desc)))
+
+(file-notify--deftest-remote file-notify-test00-availability
+  "Test availability of `file-notify' for remote files.")
+
+(when file-notify--test-local-enabled
 
   (ert-deftest file-notify-test01-add-watch ()
     "Check `file-notify-add-watch'."
@@ -99,9 +113,8 @@
       (file-notify-rm-watch desc)
 
       ;; Check error handling.
-      (should
-       (equal (car (should-error (file-notify-add-watch 1 2 3 4)))
-             'wrong-number-of-arguments))
+      (should-error (file-notify-add-watch 1 2 3 4)
+                   :type 'wrong-number-of-arguments)
       (should
        (equal (should-error (file-notify-add-watch 1 2 3))
              '(wrong-type-argument 1)))
@@ -116,7 +129,7 @@
 
   (file-notify--deftest-remote file-notify-test01-add-watch
     "Check `file-notify-add-watch' for remote files.")
-  ) ;; file-notify-support
+  ) ;; file-notify--test-local-enabled
 
 (defun file-notify--test-event-test ()
   "Ert test function to be called by `file-notify--test-event-handler'.
@@ -147,7 +160,7 @@
   (expand-file-name
    (make-temp-name "file-notify-test") temporary-file-directory))
 
-(when file-notify-support
+(when file-notify--test-local-enabled
 
   (ert-deftest file-notify-test02-events ()
     "Check file creation/removal notifications."
@@ -189,13 +202,13 @@
 
   (file-notify--deftest-remote file-notify-test02-events
     "Check file creation/removal notifications for remote files.")
-  ) ;; file-notify-support
+  ) ;; file-notify--test-local-enabled
 
 ;; autorevert runs only in interactive mode.
 (defvar auto-revert-remote-files)
 (setq auto-revert-remote-files t)
 (require 'autorevert)
-(when (and file-notify-support (null noninteractive))
+(when (and file-notify--test-local-enabled (null noninteractive))
 
   (ert-deftest file-notify-test03-autorevert ()
     "Check autorevert via file notification.
@@ -249,12 +262,12 @@
   (file-notify--deftest-remote file-notify-test03-autorevert
     "Check autorevert via file notification for remote files.
 This test is skipped in batch mode.")
-  ) ;; (and file-notify-support (null noninteractive))
+  ) ;; (and file-notify--test-local-enabled (null noninteractive))
 
 (defun file-notify-test-all (&optional interactive)
   "Run all tests for \\[file-notify]."
   (interactive "p")
-  (when file-notify-support
+  (when file-notify--test-local-enabled
     (if interactive
        (ert-run-tests-interactively "^file-notify-")
       (ert-run-tests-batch "^file-notify-"))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]