1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-18 18:05:07 +00:00

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.
This commit is contained in:
Stefan Kangas 2020-12-08 08:57:22 +01:00
parent 9e7b93f2da
commit 3b20c03316
4 changed files with 7 additions and 8 deletions

View File

@ -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))

View File

@ -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)

View File

@ -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)))))

View File

@ -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."