aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2019-05-19 16:06:20 +0200
committerMattias EngdegÄrd2019-07-24 11:52:33 +0200
commit5cfd8c508ea59739eea6093771f0f747ebd64885 (patch)
treed22b41129a3731a274592d9927bece0e1de58b39
parent52e202a500116410fd97370535c6350a025d77bf (diff)
downloademacs-5cfd8c508ea59739eea6093771f0f747ebd64885.tar.gz
emacs-5cfd8c508ea59739eea6093771f0f747ebd64885.zip
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.
-rw-r--r--test/lisp/filenotify-tests.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 4396a693e3a..2c776815e3b 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'."
487(file-notify--deftest-remote file-notify-test02-rm-watch 487(file-notify--deftest-remote file-notify-test02-rm-watch
488 "Check `file-notify-rm-watch' for remote files.") 488 "Check `file-notify-rm-watch' for remote files.")
489 489
490;; Accessors for the callback argument.
491(defun file-notify--test-event-file (event) (nth 2 event))
492(defun file-notify--test-event-file1 (event) (nth 3 event))
493
490(defun file-notify--test-event-test () 494(defun file-notify--test-event-test ()
491 "Ert test function to be called by `file-notify--test-event-handler'. 495 "Ert test function to be called by `file-notify--test-event-handler'.
492We cannot pass arguments, so we assume that `file-notify--test-event' 496We cannot pass arguments, so we assume that `file-notify--test-event'
@@ -497,13 +501,13 @@ is bound somewhere."
497 (should 501 (should
498 (string-prefix-p 502 (string-prefix-p
499 (file-notify--event-watched-file file-notify--test-event) 503 (file-notify--event-watched-file file-notify--test-event)
500 (file-notify--event-file-name file-notify--test-event))) 504 (file-notify--test-event-file file-notify--test-event)))
501 ;; Check the second file name if exists. 505 ;; Check the second file name if exists.
502 (when (eq (nth 1 file-notify--test-event) 'renamed) 506 (when (eq (nth 1 file-notify--test-event) 'renamed)
503 (should 507 (should
504 (string-prefix-p 508 (string-prefix-p
505 (file-notify--event-watched-file file-notify--test-event) 509 (file-notify--event-watched-file file-notify--test-event)
506 (file-notify--event-file1-name file-notify--test-event))))) 510 (file-notify--test-event-file1 file-notify--test-event)))))
507 511
508(defun file-notify--test-event-handler (event) 512(defun file-notify--test-event-handler (event)
509 "Run a test over FILE-NOTIFY--TEST-EVENT. 513 "Run a test over FILE-NOTIFY--TEST-EVENT.
@@ -515,7 +519,7 @@ and the event to `file-notify--test-events'."
515 ;; Do not add lock files, this would confuse the checks. 519 ;; Do not add lock files, this would confuse the checks.
516 (unless (string-match 520 (unless (string-match
517 (regexp-quote ".#") 521 (regexp-quote ".#")
518 (file-notify--event-file-name file-notify--test-event)) 522 (file-notify--test-event-file file-notify--test-event))
519 (when file-notify-debug 523 (when file-notify-debug
520 (message "file-notify--test-event-handler result: %s event: %S" 524 (message "file-notify--test-event-handler result: %s event: %S"
521 (null (ert-test-failed-p result)) file-notify--test-event)) 525 (null (ert-test-failed-p result)) file-notify--test-event))