aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPaul Eggert2018-08-21 02:05:07 -0700
committerPaul Eggert2018-08-21 02:05:31 -0700
commit77fc2725985b4e5ef977ae6930835c7f0771c61c (patch)
treec578f223cba18da66b1a7cb7a38ef7e8c29e1967 /test/src
parenteb83344fc7c08ec08b51e7700f1ac2632afa462c (diff)
downloademacs-77fc2725985b4e5ef977ae6930835c7f0771c61c.tar.gz
emacs-77fc2725985b4e5ef977ae6930835c7f0771c61c.zip
Fix glitches introduced by nthcdr changes
* src/fns.c (Fnthcdr): Fix recently-introduced bug when nthcdr is supposed to yield a non-nil non-cons. Reported by Glenn Morris and by Pip Cet here: https://lists.gnu.org/r/emacs-devel/2018-08/msg00699.html https://lists.gnu.org/r/emacs-devel/2018-08/msg00708.html Speed up nthcdr for small N, as suggested by Pip Cet here: https://lists.gnu.org/r/emacs-devel/2018-08/msg00707.html * test/src/fns-tests.el (test-nthcdr-simple): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 92dc18fa034..b180f30f285 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -624,6 +624,11 @@
624 (should (eq (gethash b2 hash) 624 (should (eq (gethash b2 hash)
625 (funcall test b1 b2))))))) 625 (funcall test b1 b2)))))))
626 626
627(ert-deftest test-nthcdr-simple ()
628 (should (eq (nthcdr 0 'x) 'x))
629 (should (eq (nthcdr 1 '(x . y)) 'y))
630 (should (eq (nthcdr 2 '(x y . z)) 'z)))
631
627(ert-deftest test-nthcdr-circular () 632(ert-deftest test-nthcdr-circular ()
628 (dolist (len '(1 2 5 37 120 997 1024)) 633 (dolist (len '(1 2 5 37 120 997 1024))
629 (let ((cycle (make-list len nil))) 634 (let ((cycle (make-list len nil)))