]> git.eshelyaron.com Git - emacs.git/commitdiff
(file-notify--test-wait-event): Rename from `file-notify--test-read-event`
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 7 Feb 2024 16:20:46 +0000 (11:20 -0500)
committerEshel Yaron <me@eshelyaron.com>
Wed, 7 Feb 2024 20:00:04 +0000 (21:00 +0100)
* test/lisp/filenotify-tests.el (file-notify--test-wait-event):
Rename to better reflect its purpose rather than
its implementation.  Also make it return nil so callers won't be
tempted to use the return value.

(cherry picked from commit f9ffa0148c3fb9e07671fae8f8ca72dd2d403163)

test/lisp/filenotify-tests.el

index 11af1f755744f56b31baeadcba0890c17754a498..28f4d5fa18156597a367f5c76e60da8f6d8f5f07 100644 (file)
@@ -74,8 +74,8 @@
 (defvar file-notify--test-events nil)
 (defvar file-notify--test-monitors nil)
 
-(defun file-notify--test-read-event ()
-  "Read one event.
+(defun file-notify--test-wait-event ()
+  "Wait for one event.
 There are different timeouts for local and remote file notification libraries."
   (read-event
    nil nil
@@ -87,7 +87,8 @@ There are different timeouts for local and remote file notification libraries."
     ;; for any monitor.
     ((file-notify--test-monitor) 7)
     ((file-remote-p temporary-file-directory) 0.1)
-    (t 0.01))))
+    (t 0.01)))
+  nil)
 
 (defun file-notify--test-timeout ()
   "Timeout to wait for arriving a bunch of events, in seconds."
@@ -103,7 +104,7 @@ There are different timeouts for local and remote file notification libraries."
 TIMEOUT is the maximum time to wait for, in seconds."
   `(with-timeout (,timeout (ignore))
      (while (null ,until)
-       (file-notify--test-read-event))))
+       (file-notify--test-wait-event))))
 
 (defun file-notify--test-no-descriptors ()
   "Check that `file-notify-descriptors' is an empty hash table.
@@ -452,7 +453,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
       ;; Check, that removing watch descriptors out of order do not
       ;; harm.  This fails on cygwin because of timing issues unless a
       ;; long `sit-for' is added before the call to
-      ;; `file-notify--test-read-event'.
+      ;; `file-notify--test-wait-event'.
       (unless (eq system-type 'cygwin)
         (let (results)
           (cl-flet ((first-callback (event)
@@ -480,7 +481,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
             ;; Remove first watch.
             (file-notify-rm-watch file-notify--test-desc)
             ;; Only the second callback shall run.
-           (file-notify--test-read-event)
+           (file-notify--test-wait-event)
             (delete-file file-notify--test-tmpfile)
             (file-notify--test-wait-for-events
              (file-notify--test-timeout) results)
@@ -622,7 +623,7 @@ delivered."
            (cons 'file-notify while-no-input-ignore-events))
           create-lockfiles)
      ;; Flush pending actions.
-     (file-notify--test-read-event)
+     (file-notify--test-wait-event)
      (file-notify--test-wait-for-events
       (file-notify--test-timeout)
       (not (input-pending-p)))
@@ -671,7 +672,7 @@ delivered."
              (t '(created changed deleted stopped)))
           (write-region
            "another text" nil file-notify--test-tmpfile nil 'no-message)
-          (file-notify--test-read-event)
+          (file-notify--test-wait-event)
           (delete-file file-notify--test-tmpfile))
         (file-notify-rm-watch file-notify--test-desc)
 
@@ -707,7 +708,7 @@ delivered."
                  (changed changed deleted stopped))))
           (write-region
            "another text" nil file-notify--test-tmpfile nil 'no-message)
-          (file-notify--test-read-event)
+          (file-notify--test-wait-event)
           (delete-file file-notify--test-tmpfile))
         (file-notify-rm-watch file-notify--test-desc)
 
@@ -755,7 +756,7 @@ delivered."
             (t '(created changed deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
           (delete-directory file-notify--test-tmpdir 'recursive))
         (file-notify-rm-watch file-notify--test-desc)
 
@@ -805,14 +806,14 @@ delivered."
                  deleted deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
          ;; The next two events shall not be visible.
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (set-file-modes file-notify--test-tmpfile 000 'nofollow)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
           (delete-directory file-notify--test-tmpdir 'recursive))
         (file-notify-rm-watch file-notify--test-desc)
 
@@ -860,10 +861,10 @@ delivered."
             (t '(created changed renamed deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
          ;; After the rename, we won't get events anymore.
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
           (delete-directory file-notify--test-tmpdir 'recursive))
         (file-notify-rm-watch file-notify--test-desc)
 
@@ -912,11 +913,11 @@ delivered."
             (t '(attribute-changed attribute-changed)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (set-file-modes file-notify--test-tmpfile 000 'nofollow)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (delete-file file-notify--test-tmpfile))
         (file-notify-rm-watch file-notify--test-desc)
 
@@ -1087,7 +1088,7 @@ delivered."
                  (changed changed deleted stopped))))
           (write-region
            "another text" nil file-notify--test-tmpfile nil 'no-message)
-         (file-notify--test-read-event)
+         (file-notify--test-wait-event)
          (delete-file file-notify--test-tmpfile))
        ;; After deleting the file, the descriptor is not valid anymore.
         (should-not (file-notify-valid-p file-notify--test-desc))
@@ -1134,7 +1135,7 @@ delivered."
               (t '(created changed deleted deleted stopped)))
            (write-region
             "any text" nil file-notify--test-tmpfile nil 'no-message)
-           (file-notify--test-read-event)
+           (file-notify--test-wait-event)
            (delete-directory file-notify--test-tmpdir 'recursive))
          ;; After deleting the parent directory, the descriptor must
          ;; not be valid anymore.
@@ -1247,9 +1248,9 @@ delivered."
           (let ((source-file-list source-file-list)
                 (target-file-list target-file-list))
             (while (and source-file-list target-file-list)
-              (file-notify--test-read-event)
+              (file-notify--test-wait-event)
               (write-region "" nil (pop source-file-list) nil 'no-message)
-              (file-notify--test-read-event)
+              (file-notify--test-wait-event)
               (write-region "" nil (pop target-file-list) nil 'no-message))))
         (file-notify--test-with-actions
            (cond
@@ -1272,11 +1273,11 @@ delivered."
           (let ((source-file-list source-file-list)
                 (target-file-list target-file-list))
             (while (and source-file-list target-file-list)
-              (file-notify--test-read-event)
+              (file-notify--test-wait-event)
               (rename-file (pop source-file-list) (pop target-file-list) t))))
         (file-notify--test-with-actions (make-list n 'deleted)
           (dolist (file target-file-list)
-            (file-notify--test-read-event)
+            (file-notify--test-wait-event)
             (delete-file file)))
         (delete-directory file-notify--test-tmpfile)
         (if (or (string-equal (file-notify--test-library) "w32notify")
@@ -1464,7 +1465,7 @@ the file watch."
                ;; does not report the `changed' event.
                 (make-list (/ n 2) 'created)))
             (dotimes (i n)
-              (file-notify--test-read-event)
+              (file-notify--test-wait-event)
               (if (zerop (mod i 2))
                   (write-region
                    "any text" nil file-notify--test-tmpfile1 t 'no-message)