summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2017-10-05 12:41:35 -0700
committerGemini Lasswell <gazally@runbox.com>2017-10-05 12:43:15 -0700
commit9a10c8713b8dd46738365d35263ae0687e2063cc (patch)
treef32070e3443094961bdea1486a12645523ac8523 /test/lisp/emacs-lisp
parent2a32ee1fbc148d440fc12aa390ed3d2cc7d6fe3b (diff)
downloademacs-9a10c8713b8dd46738365d35263ae0687e2063cc.tar.gz
emacs-9a10c8713b8dd46738365d35263ae0687e2063cc.tar.bz2
emacs-9a10c8713b8dd46738365d35263ae0687e2063cc.zip
Fix dynamic binding wrapper in iter-lambda (bug#25965)
* lisp/emacs-lisp/generator.el (cps--make-dynamic-binding-wrapper): Remove extra evaluation of form. * test/lisp/emacs-lisp/generator-tests.el (cps-iter-lambda-with-dynamic-binding): New test.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/generator-tests.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/generator-tests.el b/test/lisp/emacs-lisp/generator-tests.el
index 4cc6c841dac..cbb136ae919 100644
--- a/test/lisp/emacs-lisp/generator-tests.el
+++ b/test/lisp/emacs-lisp/generator-tests.el
@@ -282,3 +282,13 @@ identical output.
(ert-deftest cps-test-declarations-preserved ()
(should (equal (documentation 'generator-with-docstring) "Documentation!"))
(should (equal (get 'generator-with-docstring 'lisp-indent-function) 5)))
+
+(ert-deftest cps-iter-lambda-with-dynamic-binding ()
+ "`iter-lambda' with dynamic binding produces correct result (bug#25965)."
+ (should (= 1
+ (iter-next
+ (funcall (iter-lambda ()
+ (let* ((fill-column 10) ;;any special variable will do
+ (i 0)
+ (j (setq i (1+ i))))
+ (iter-yield i))))))))