emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 5cfd8c5 1/5: Local definitions of accessors only us


From: Mattias Engdegård
Subject: [Emacs-diffs] master 5cfd8c5 1/5: Local definitions of accessors only used in test
Date: Wed, 24 Jul 2019 06:06:46 -0400 (EDT)

branch: master
commit 5cfd8c508ea59739eea6093771f0f747ebd64885
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Local definitions of accessors only used in test
    
    * test/lisp/filenotify-tests.el (file-notify--test-event-file)
    (file-notify--test-event-file1, file-notify--test-event-test)
    (file-notify--test-event-handler):
    Define accessors locally, so that they can be removed from filenotify.el.
---
 test/lisp/filenotify-tests.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 4396a69..2c77681 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -487,6 +487,10 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
 (file-notify--deftest-remote file-notify-test02-rm-watch
   "Check `file-notify-rm-watch' for remote files.")
 
+;; Accessors for the callback argument.
+(defun file-notify--test-event-file (event) (nth 2 event))
+(defun file-notify--test-event-file1 (event) (nth 3 event))
+
 (defun file-notify--test-event-test ()
   "Ert test function to be called by `file-notify--test-event-handler'.
 We cannot pass arguments, so we assume that `file-notify--test-event'
@@ -497,13 +501,13 @@ is bound somewhere."
   (should
    (string-prefix-p
     (file-notify--event-watched-file file-notify--test-event)
-    (file-notify--event-file-name file-notify--test-event)))
+    (file-notify--test-event-file file-notify--test-event)))
   ;; Check the second file name if exists.
   (when (eq (nth 1 file-notify--test-event) 'renamed)
     (should
      (string-prefix-p
       (file-notify--event-watched-file file-notify--test-event)
-      (file-notify--event-file1-name file-notify--test-event)))))
+      (file-notify--test-event-file1 file-notify--test-event)))))
 
 (defun file-notify--test-event-handler (event)
   "Run a test over FILE-NOTIFY--TEST-EVENT.
@@ -515,7 +519,7 @@ and the event to `file-notify--test-events'."
     ;; Do not add lock files, this would confuse the checks.
     (unless (string-match
             (regexp-quote ".#")
-            (file-notify--event-file-name file-notify--test-event))
+            (file-notify--test-event-file file-notify--test-event))
       (when file-notify-debug
         (message "file-notify--test-event-handler result: %s event: %S"
                  (null (ert-test-failed-p result)) file-notify--test-event))



reply via email to

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