From: Noam Postavsky Date: Thu, 31 Aug 2017 08:57:43 +0000 (-0400) Subject: ; Let files-tests.el pass multiple times in a session X-Git-Tag: emacs-26.1-rc1~264 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4c8157cfe06ef5715ba8533be164dd9a047711d0;p=emacs.git ; 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. --- 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.") (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"))