aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky2017-08-31 04:57:43 -0400
committerNoam Postavsky2018-02-02 18:09:13 -0500
commit4c8157cfe06ef5715ba8533be164dd9a047711d0 (patch)
tree311a54e83bb8382d3c86ef8749042469027b6f37 /test
parent99251ab62e8e2796a2ebc486afd7c0faf173a1b6 (diff)
downloademacs-4c8157cfe06ef5715ba8533be164dd9a047711d0.tar.gz
emacs-4c8157cfe06ef5715ba8533be164dd9a047711d0.zip
; 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.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/files-tests.el22
1 files changed, 10 insertions, 12 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 8dbfc2965ca..d51f8bb9f80 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -135,18 +135,16 @@ form.")
135 135
136(ert-deftest files-test-local-variables () 136(ert-deftest files-test-local-variables ()
137 "Test the file-local variables implementation." 137 "Test the file-local variables implementation."
138 (unwind-protect 138 (cl-letf (((symbol-function 'hack-local-variables-confirm)
139 (progn 139 (lambda (&rest _)
140 (defadvice hack-local-variables-confirm (around files-test activate) 140 (setq files-test-result 'query)
141 (setq files-test-result 'query) 141 nil)))
142 nil) 142 (dolist (test files-test-local-variable-data)
143 (dolist (test files-test-local-variable-data) 143 (let ((str (concat "text\n\n;; Local Variables:\n;; "
144 (let ((str (concat "text\n\n;; Local Variables:\n;; " 144 (mapconcat 'identity (car test) "\n;; ")
145 (mapconcat 'identity (car test) "\n;; ") 145 "\n;; End:\n")))
146 "\n;; End:\n"))) 146 (dolist (subtest (cdr test))
147 (dolist (subtest (cdr test)) 147 (should (file-test--do-local-variables-test str subtest)))))))
148 (should (file-test--do-local-variables-test str subtest))))))
149 (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test)))
150 148
151(defvar files-test-bug-18141-file 149(defvar files-test-bug-18141-file
152 (expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY")) 150 (expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY"))