diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-05-16 22:23:28 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-05-16 22:25:07 -0700 |
commit | 313955110b242cd18fc19bd168032d3ddf39fe94 (patch) | |
tree | 4292cf3b216b6a76e5c28e3841c2f6fa2f56caf3 /test/lisp/password-cache-tests.el | |
parent | 1fc4e3fb3f6caba6a4ca69060c7992ea5d24ff36 (diff) | |
download | emacs-313955110b242cd18fc19bd168032d3ddf39fe94.tar.gz |
Don’t attempt to modify constant strings
* lisp/bookmark.el (bookmark-bmenu-set-header):
Use copy-sequence instead of concat, for clarity.
Also, the byte-compiler optimizes (concat "a" "b") into "ab".
* lisp/button.el (make-text-button):
* test/lisp/erc/erc-track-tests.el (erc-track--erc-faces-in):
* test/lisp/password-cache-tests.el:
(password-cache-tests-add-and-remove)
(password-cache-tests-read-from-cache)
(password-cache-tests-in-cache-p, password-cache-tests-read)
(password-cache-tests-reset)
(password-cache-tests-add/expires-key)
(password-cache-tests-no-password-cache):
Don’t attempt to modify constant strings.
* lisp/progmodes/elisp-mode.el (elisp--xref-format)
(elisp--xref-format-extra):
Don’t attempt to modify constant strings via put-text-property.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-across-ref):
Don’t attempt to modify constant vectors or strings.
Diffstat (limited to 'test/lisp/password-cache-tests.el')
-rw-r--r-- | test/lisp/password-cache-tests.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/lisp/password-cache-tests.el b/test/lisp/password-cache-tests.el index 01f4358fc59..55ebbfce7fe 100644 --- a/test/lisp/password-cache-tests.el +++ b/test/lisp/password-cache-tests.el @@ -28,31 +28,31 @@ (ert-deftest password-cache-tests-add-and-remove () (let ((password-data (copy-hash-table password-data))) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (should (eq (password-in-cache-p "foo") t)) (password-cache-remove "foo") (should (not (password-in-cache-p "foo"))))) (ert-deftest password-cache-tests-read-from-cache () (let ((password-data (copy-hash-table password-data))) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (should (equal (password-read-from-cache "foo") "bar")) (should (not (password-read-from-cache nil))))) (ert-deftest password-cache-tests-in-cache-p () (let ((password-data (copy-hash-table password-data))) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (should (password-in-cache-p "foo")) (should (not (password-read-from-cache nil))))) (ert-deftest password-cache-tests-read () (let ((password-data (copy-hash-table password-data))) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (should (equal (password-read nil "foo") "bar")))) (ert-deftest password-cache-tests-reset () (let ((password-data (copy-hash-table password-data))) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (password-reset) (should (not (password-in-cache-p "foo"))))) @@ -60,14 +60,14 @@ :tags '(:expensive-test) (let ((password-data (copy-hash-table password-data)) (password-cache-expiry 0.01)) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (sit-for 0.1) (should (not (password-in-cache-p "foo"))))) (ert-deftest password-cache-tests-no-password-cache () (let ((password-data (copy-hash-table password-data)) (password-cache nil)) - (password-cache-add "foo" "bar") + (password-cache-add "foo" (copy-sequence "bar")) (should (not (password-in-cache-p "foo"))) (should (not (password-read-from-cache "foo"))))) |