mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-24 10:38:38 +00:00
; Let files-tests.el pass multiple times in a session
* test/lisp/files-tests.el (files-test-local-variables): Use `cl-letf' instead of advice. The advice was not being activated on the second run.
This commit is contained in:
parent
99251ab62e
commit
4c8157cfe0
@ -135,18 +135,16 @@ form.")
|
||||
|
||||
(ert-deftest files-test-local-variables ()
|
||||
"Test the file-local variables implementation."
|
||||
(unwind-protect
|
||||
(progn
|
||||
(defadvice hack-local-variables-confirm (around files-test activate)
|
||||
(setq files-test-result 'query)
|
||||
nil)
|
||||
(dolist (test files-test-local-variable-data)
|
||||
(let ((str (concat "text\n\n;; Local Variables:\n;; "
|
||||
(mapconcat 'identity (car test) "\n;; ")
|
||||
"\n;; End:\n")))
|
||||
(dolist (subtest (cdr test))
|
||||
(should (file-test--do-local-variables-test str subtest))))))
|
||||
(ad-disable-advice 'hack-local-variables-confirm 'around 'files-test)))
|
||||
(cl-letf (((symbol-function 'hack-local-variables-confirm)
|
||||
(lambda (&rest _)
|
||||
(setq files-test-result 'query)
|
||||
nil)))
|
||||
(dolist (test files-test-local-variable-data)
|
||||
(let ((str (concat "text\n\n;; Local Variables:\n;; "
|
||||
(mapconcat 'identity (car test) "\n;; ")
|
||||
"\n;; End:\n")))
|
||||
(dolist (subtest (cdr test))
|
||||
(should (file-test--do-local-variables-test str subtest)))))))
|
||||
|
||||
(defvar files-test-bug-18141-file
|
||||
(expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY"))
|
||||
|
Loading…
Reference in New Issue
Block a user