summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2020-04-30 18:55:40 -0400
committerNoam Postavsky <npostavs@gmail.com>2020-05-07 08:23:56 -0400
commitddc8020327604b92e7e830708933f62a22f48f62 (patch)
treecfe881705093a9c4c1e726e4909a57abaf59ddf2 /test/lisp/emacs-lisp
parentde7158598fcd5440c0180ff6f83052c29e490bcd (diff)
downloademacs-ddc8020327604b92e7e830708933f62a22f48f62.tar.gz
Don't increment array index in cl-loop twice (Bug#40727)
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Put the temp-idx increment in cl--loop-body, leaving just the side-effect free testing of the index for both cl--loop-body and cl--loop-conditions. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-arrays): Extend test to cover this case.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/cl-macs-tests.el3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el
index 77609a42a99..983e79ac57c 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -43,6 +43,9 @@
"Bug#40727"
(should (equal (cl-loop for y = (- (or x 0)) and x across [1 2]
collect (cons x y))
+ '((1 . 0) (2 . -1))))
+ (should (equal (cl-loop for x across [1 2] and y = (- (or x 0))
+ collect (cons x y))
'((1 . 0) (2 . -1)))))
(ert-deftest cl-macs-loop-destructure ()