diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-10-02 18:38:02 +0200 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-10-02 21:20:53 +0200 |
commit | 825e85b393a3d78ba43176ecc5bc1a9595d0fbea (patch) | |
tree | 0a26bf4566ec11cbdc7200dd7f0f0f60a927d7eb /test/lisp/files-tests.el | |
parent | d07d7ab1a0e321ced62ebe5dd9db27eb7e93430e (diff) | |
download | emacs-825e85b393a3d78ba43176ecc5bc1a9595d0fbea.tar.gz emacs-825e85b393a3d78ba43176ecc5bc1a9595d0fbea.tar.bz2 emacs-825e85b393a3d78ba43176ecc5bc1a9595d0fbea.zip |
Use `advice-flet' in place of `cl-letf' to avoid primitive redefinition
* test/lisp/time-stamp-tests.el (with-time-stamp-system-name): Use
`advice-flet' to advice primitive avoiding redefinition.
* test/lisp/tempo-tests.el (tempo-p-element-test)
(tempo-P-element-test, tempo-r-element-test)
(tempo-s-element-test, tempo-r>-element-test): Likewise.
* test/lisp/subr-tests.el (subr-tests-bug22027): Likewise.
* test/lisp/shadowfile-tests.el (shadow-test00-clusters)
(shadow-test01-sites, shadow-test06-literal-groups)
(shadow-test07-regexp-groups): Likewise.
* test/lisp/replace-tests.el (replace-tests-with-undo): Likewise.
* test/lisp/play/dissociate-tests.el
(dissociate-tests-dissociated-press): Likewise.
* test/lisp/net/tramp-tests.el (tramp-test10-write-region)
(tramp-test21-file-links): Likewise.
* test/lisp/kmacro-tests.el (kmacro-tests-call-macro-hint-and-repeat)
(kmacro-tests-repeat-on-last-key)
(kmacro-tests-repeat-view-and-run)
(kmacro-tests-bind-to-key-with-key-sequence-in-use): Likewise.
* test/lisp/files-tests.el (files-tests-read-file-in-~): Likewise.
* test/lisp/emacs-lisp/rmc-tests.el (test-read-multiple-choice):
Likewise.
* test/lisp/bookmark-tests.el (bookmark-test-bmenu-locate):
Likewise.
* test/lisp/abbrev-tests.el
(inverse-add-abbrev-skips-trailing-nonword)
(inverse-add-abbrev-skips-trailing-nonword/positive-arg)
(inverse-add-abbrev-skips-trailing-nonword/negative-arg): Likewise.
Diffstat (limited to 'test/lisp/files-tests.el')
-rw-r--r-- | test/lisp/files-tests.el | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 54801adda63..2e9c6adc947 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -242,24 +242,25 @@ form.") "Test file prompting in directory named `~'. If we are in a directory named `~', the default value should not be $HOME." - (cl-letf (((symbol-function 'completing-read) - (lambda (_prompt _coll &optional _pred _req init _hist def _) - (or def init))) - (dir (make-temp-file "read-file-name-test" t))) - (unwind-protect - (let ((subdir (expand-file-name "./~/" dir))) - (make-directory subdir t) - (with-temp-buffer - (setq default-directory subdir) - (should-not (equal - (expand-file-name (read-file-name "File: ")) - (expand-file-name "~/"))) - ;; Don't overquote either! - (setq default-directory (concat "/:" subdir)) - (should-not (equal - (expand-file-name (read-file-name "File: ")) - (concat "/:/:" subdir))))) - (delete-directory dir 'recursive)))) + (let* ((dir (make-temp-file "read-file-name-test" t)) + (subdir (expand-file-name "./~/" dir))) + (advice-flet ((completing-read + (lambda (_prompt _coll &optional _pred _req init _hist def _) + (or def init)))) + (unwind-protect + (progn + (make-directory subdir t) + (with-temp-buffer + (setq default-directory subdir) + (should-not (equal + (expand-file-name (read-file-name "File: ")) + (expand-file-name "~/"))) + ;; Don't overquote either! + (setq default-directory (concat "/:" subdir)) + (should-not (equal + (expand-file-name (read-file-name "File: ")) + (concat "/:/:" subdir))))) + (delete-directory dir 'recursive))))) (ert-deftest files-tests-file-name-non-special-quote-unquote () (let (;; Just in case it is quoted, who knows. |