1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00

Don't mutate constants in tests

* test/lisp/emacs-lisp/cl-macs-tests.el
(cl-macs-test--symbol-macrolet):
* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-ellipsis-circular):
* test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
(eieio-test-persist-interior-lists):
* test/lisp/textmodes/reftex-tests.el (reftex-all-used-citation-keys):
* test/src/xdisp-tests.el (xdisp-tests--minibuffer-resizing):
* test/src/fns-tests.el (test-vector-delete):
Mutate created objects, not constants.

* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-add-display-text-property): Mutate a created string, and
compare using `equal-including-properties` without which the test was
rather meaningless.

* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test16-directory-files): Don't mutate.
This commit is contained in:
Mattias Engdegård 2023-05-13 13:36:50 +02:00
parent 9f856e4cd0
commit 63be4d11b5
8 changed files with 19 additions and 17 deletions

View file

@ -535,7 +535,7 @@ collection clause."
(eval '(let ((l (list 1))) (cl-symbol-macrolet ((x 1)) (setq (car l) 0))) t))
;; Make sure `gv-synthetic-place' isn't macro-expanded before `setf' gets to
;; see its `gv-expander'.
(should (equal (let ((l '(0)))
(should (equal (let ((l (list 0)))
(let ((cl (car l)))
(cl-symbol-macrolet
((p (gv-synthetic-place cl (lambda (v) `(setcar l ,v)))))

View file

@ -90,7 +90,7 @@
(ert-deftest cl-print-tests-ellipsis-circular ()
"Ellipsis expansion works with circular objects."
(let ((wide-obj (list 0 1 2 3 4))
(deep-obj `(0 (1 (2 (3 (4))))))
(deep-obj (list 0 (list 1 (list 2 (list 3 (list 4))))))
(print-length 4)
(print-level 3))
(setf (nth 4 wide-obj) wide-obj)

View file

@ -329,8 +329,8 @@ persistent class.")
"container-" emacs-version ".eieio")))
(john (make-instance 'person :name "John"))
(alexie (make-instance 'person :name "Alexie"))
(alst '(("first" (one two three))
("second" (four five six)))))
(alst (list (list "first" (list 'one 'two 'three))
(list "second" (list 'four 'five 'six)))))
(setf (slot-value thing 'alist) alst)
(puthash "alst" alst (slot-value thing 'htab))
(aset (slot-value thing 'vec) 0 alst)

View file

@ -709,14 +709,15 @@
[(raise 0.5) (height 2.0)]))
(should (equal (get-text-property 9 'display) '(raise 0.5))))
(with-temp-buffer
(should (equal (let ((str "some useless string"))
(add-display-text-property 4 8 'height 2.0 str)
(add-display-text-property 2 12 'raise 0.5 str)
str)
#("some useless string"
2 4 (display (raise 0.5))
4 8 (display ((raise 0.5) (height 2.0)))
8 12 (display (raise 0.5)))))))
(should (equal-including-properties
(let ((str (copy-sequence "some useless string")))
(add-display-text-property 4 8 'height 2.0 str)
(add-display-text-property 2 12 'raise 0.5 str)
str)
#("some useless string"
2 4 (display (raise 0.5))
4 8 (display ((raise 0.5) (height 2.0)))
8 12 (display (raise 0.5)))))))
(ert-deftest subr-x-named-let ()
(let ((funs ()))