emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3b20c03 8/9: Prefer setq-local in tests


From: Stefan Kangas
Subject: master 3b20c03 8/9: Prefer setq-local in tests
Date: Tue, 8 Dec 2020 03:32:13 -0500 (EST)

branch: master
commit 3b20c0331693e915a3d52d1b99c570d9816db015
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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.
---
 test/lisp/allout-tests.el                                 | 6 +++---
 test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el | 4 ++--
 test/lisp/epg-tests.el                                    | 3 +--
 test/src/data-tests.el                                    | 2 +-
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/test/lisp/allout-tests.el b/test/lisp/allout-tests.el
index f7cd6db..c979d08 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 c77f2dc..6e9d50f 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 c9c92f5..87d19e8 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 1312683..c5fc3ea 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]