From: Mattias EngdegÄrd Date: Sun, 9 Apr 2023 08:57:43 +0000 (+0200) Subject: ; * test/src/fns-tests.el: Strengthen tests of `nreverse`. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=39a0b6cb027eb3f0349f4275ceed2ccca2cd14f4;p=emacs.git ; * test/src/fns-tests.el: Strengthen tests of `nreverse`. --- diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 6f79d3277a8..2859123da80 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -114,22 +114,24 @@ (should-error (nreverse 1)) (should-error (nreverse (make-char-table 'foo))) (should (equal (nreverse (copy-sequence "xyzzy")) "yzzyx")) - (let ((A (vector))) - (nreverse A) - (should (equal A []))) - (let ((A (vector 0))) - (nreverse A) - (should (equal A [0]))) - (let ((A (vector 1 2 3 4))) - (nreverse A) - (should (equal A [4 3 2 1]))) - (let ((A (vector 1 2 3 4))) - (nreverse A) - (nreverse A) - (should (equal A [1 2 3 4]))) + (let* ((A (vector)) + (B (nreverse A))) + (should (equal A [])) + (should (eq B A))) + (let* ((A (vector 0)) + (B (nreverse A))) + (should (equal A [0])) + (should (eq B A))) (let* ((A (vector 1 2 3 4)) - (B (nreverse (nreverse A)))) - (should (equal A B)))) + (B (nreverse A))) + (should (equal A [4 3 2 1])) + (should (eq B A))) + (let* ((A (vector 1 2 3 4)) + (B (nreverse A)) + (C (nreverse A))) + (should (equal A [1 2 3 4])) + (should (eq B A)) + (should (eq C A)))) (ert-deftest fns-tests-reverse-bool-vector () (let ((A (make-bool-vector 10 nil))) @@ -140,9 +142,10 @@ (ert-deftest fns-tests-nreverse-bool-vector () (let ((A (make-bool-vector 10 nil))) (dotimes (i 5) (aset A i t)) - (nreverse A) - (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) - (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) + (let ((B (nreverse A))) + (should (eq B A)) + (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) + (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A))))))) (defconst fns-tests--string-lessp-cases `(("abc" < "abd")