summaryrefslogtreecommitdiff
path: root/test/lisp/dired-tests.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-12-04 15:49:42 +0100
committerStefan Kangas <stefan@marxist.se>2021-12-04 15:49:42 +0100
commit7c68c84674d67d7bee9d78b99ce01ad789a77961 (patch)
tree0e032bbcf81af016da4cbab3d1de4c84f76a9cc4 /test/lisp/dired-tests.el
parentaa6681a51ad12e3fd8363febfbaacebe9dc06510 (diff)
downloademacs-7c68c84674d67d7bee9d78b99ce01ad789a77961.tar.gz
Silence byte-compiler in some tests
* test/lisp/dired-tests.el: * test/lisp/emacs-lisp/cl-macs-tests.el: * test/lisp/emacs-lisp/derived-tests.el: * test/lisp/emacs-lisp/eieio-tests/eieio-tests.el: * test/lisp/emacs-lisp/generator-tests.el: * test/lisp/emacs-lisp/lisp-tests.el: * test/lisp/emacs-lisp/seq-tests.el (test-seq-let) (test-seq-setq): * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-if-let*-false) (subr-x-test-if-let*-and-laziness-is-preserved) (subr-x-test-when-let*-false) (subr-x-test-when-let*-and-laziness-is-preserved): * test/lisp/emacs-lisp/timer-tests.el (timer-tests-debug-timer-check): * test/lisp/format-spec-tests.el (format-spec-do-flags-truncate) (format-spec-do-flags-pad): * test/lisp/ls-lisp-tests.el (ls-lisp-test-bug27762): * test/lisp/obsolete/cl-tests.el (labels-function-quoting): * test/lisp/progmodes/elisp-mode-tests.el: * test/lisp/replace-tests.el (replace-regexp-bug45973): * test/lisp/ses-tests.el: * test/lisp/subr-tests.el: * test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode): * test/src/data-tests.el (data-tests--set-default-per-buffer): * test/src/search-tests.el (test-replace-match-modification-hooks): Silence byte-compiler.
Diffstat (limited to 'test/lisp/dired-tests.el')
-rw-r--r--test/lisp/dired-tests.el49
1 files changed, 31 insertions, 18 deletions
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 43791118f14..1c4f37bd327 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -543,10 +543,12 @@ path's data to use."
((equal "." path) default-directory)
(path)))
(return-size
- (car (files-tests--look-up-free-data path))))
+ ;; It is always defined but this silences the byte-compiler:
+ (when (fboundp 'files-tests--look-up-free-data)
+ (car (files-tests--look-up-free-data path)))))
(list return-size return-size return-size))))
- (defun files-tests--insert-directory-output (dir &optional verbose)
+ (defun files-tests--insert-directory-output (dir &optional _verbose)
"Run `insert-directory' and return its output."
(with-current-buffer-window "files-tests--insert-directory" nil nil
(let ((dired-free-space 'separate))
@@ -555,35 +557,46 @@ path's data to use."
(ert-deftest files-tests-insert-directory-shows-files ()
"Verify `insert-directory' reports the files in the directory."
- (let* ((test-dir (car test-files))
- (files (cdr test-files))
- (output (files-tests--insert-directory-output test-dir)))
- (dolist (file files)
- (should (string-match-p file output)))))
+ ;; It is always defined but this silences the byte-compiler:
+ (when (fboundp 'files-tests--insert-directory-output)
+ (let* ((test-dir (car test-files))
+ (files (cdr test-files))
+ (output (files-tests--insert-directory-output test-dir)))
+ (dolist (file files)
+ (should (string-match-p file output))))))
(defun files-tests--insert-directory-shows-given-free (dir &optional
info-func)
"Run `insert-directory' and verify it reports the correct available space.
Stub `file-system-info' to ensure the available space is consistent,
either with the given stub function or a default one using test data."
- (cl-letf (((symbol-function 'file-system-info)
- (or info-func
- (files-tests--make-file-system-info-stub))))
- (should (string-match-p (cadr
- (files-tests--look-up-free-data dir))
- (files-tests--insert-directory-output dir t)))))
+ ;; It is always defined but this silences the byte-compiler:
+ (when (and (fboundp 'files-tests--make-file-system-info-stub)
+ (fboundp 'files-tests--look-up-free-data)
+ (fboundp 'files-tests--insert-directory-output))
+ (cl-letf (((symbol-function 'file-system-info)
+ (or info-func
+ (files-tests--make-file-system-info-stub))))
+ (should (string-match-p (cadr
+ (files-tests--look-up-free-data dir))
+ (files-tests--insert-directory-output dir t))))))
(ert-deftest files-tests-insert-directory-shows-free ()
"Test that verbose `insert-directory' shows the correct available space."
- (files-tests--insert-directory-shows-given-free
- test-dir
- (files-tests--make-file-system-info-stub test-dir)))
+ ;; It is always defined but this silences the byte-compiler:
+ (when (and (fboundp 'files-tests--insert-directory-shows-given-free)
+ (fboundp 'files-tests--make-file-system-info-stub))
+ (files-tests--insert-directory-shows-given-free
+ test-dir
+ (files-tests--make-file-system-info-stub test-dir))))
(ert-deftest files-tests-bug-50630 ()
"Verify verbose `insert-directory' shows free space of the target directory.
The current directory at call time should not affect the result (Bug#50630)."
- (let ((default-directory test-dir-other))
- (files-tests--insert-directory-shows-given-free test-dir))))
+ ;; It is always defined but this silences the byte-compiler:
+ (when (fboundp 'files-tests--insert-directory-shows-given-free)
+ (let ((default-directory test-dir-other))
+ (files-tests--insert-directory-shows-given-free test-dir)))))
(provide 'dired-tests)
;;; dired-tests.el ends here