From: Stefan Kangas Date: Tue, 8 Dec 2020 07:57:22 +0000 (+0100) Subject: Prefer setq-local in tests X-Git-Tag: emacs-28.0.90~4861 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3b20c0331693e915a3d52d1b99c570d9816db015;p=emacs.git Prefer setq-local in tests * test/lisp/allout-tests.el (allout-test-resumption-prior-value-resumed) (allout-test-resumption-multiple-holds) (allout-test-resumption-unbinding): * test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el (faceup-test-mode): * test/lisp/epg-tests.el (with-epg-tests): * test/src/data-tests.el (binding-test-buffer-A): Prefer setq-local. --- diff --git a/test/lisp/allout-tests.el b/test/lisp/allout-tests.el index f7cd6db9cd4..c979d085c89 100644 --- a/test/lisp/allout-tests.el +++ b/test/lisp/allout-tests.el @@ -74,7 +74,7 @@ "Ensure that prior local value is resumed." (with-temp-buffer (allout-tests-obliterate-variable 'allout-tests-locally-true) - (set (make-local-variable 'allout-tests-locally-true) t) + (setq-local allout-tests-locally-true t) (cl-assert (not (default-boundp 'allout-tests-locally-true)) nil (concat "Test setup mistake -- variable supposed to" " not have global binding, but it does.")) @@ -98,7 +98,7 @@ (allout-tests-obliterate-variable 'allout-tests-globally-true) (setq allout-tests-globally-true t) (allout-tests-obliterate-variable 'allout-tests-locally-true) - (set (make-local-variable 'allout-tests-locally-true) t) + (setq-local allout-tests-locally-true t) (allout-add-resumptions '(allout-tests-globally-unbound t) '(allout-tests-globally-true nil) '(allout-tests-locally-true nil)) @@ -135,7 +135,7 @@ (allout-tests-obliterate-variable 'allout-tests-globally-true) (setq allout-tests-globally-true t) (allout-tests-obliterate-variable 'allout-tests-locally-true) - (set (make-local-variable 'allout-tests-locally-true) t) + (setq-local allout-tests-locally-true t) (allout-add-resumptions '(allout-tests-globally-unbound t) '(allout-tests-globally-true nil) '(allout-tests-locally-true nil)) diff --git a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el index c77f2dc4990..6e9d50fc38f 100644 --- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el +++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el @@ -67,8 +67,8 @@ If `prog-mode' is defined, inherit from it." (faceup-test-define-prog-mode faceup-test-mode "faceup-test" "Dummy major mode for testing `faceup', a test system for font-lock." - (set (make-local-variable 'syntax-propertize-function) - #'faceup-test-syntax-propertize) + (setq-local syntax-propertize-function + #'faceup-test-syntax-propertize) (setq font-lock-defaults '(faceup-test-font-lock-keywords nil))) (provide 'faceup-test-mode) diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el index c9c92f529be..87d19e8b294 100644 --- a/test/lisp/epg-tests.el +++ b/test/lisp/epg-tests.el @@ -96,8 +96,7 @@ context (ert-resource-file "seckey.asc"))) (with-temp-buffer - (make-local-variable 'epg-tests-context) - (setq epg-tests-context context) + (setq-local epg-tests-context context) ,@body)) (when (file-directory-p epg-tests-home-directory) (delete-directory epg-tests-home-directory t))))) diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 1312683c848..c5fc3eaa11a 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -324,7 +324,7 @@ comparing the subr with a much slower lisp implementation." (defvar binding-test-some-local 'some) (with-current-buffer binding-test-buffer-A - (set (make-local-variable 'binding-test-some-local) 'local)) + (setq-local binding-test-some-local 'local)) (ert-deftest binding-test-manual () "A test case from the elisp manual."