emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 15288f4771: compat-29: Add while-let test


From: ELPA Syncer
Subject: [elpa] externals/compat 15288f4771: compat-29: Add while-let test
Date: Thu, 12 Jan 2023 14:57:25 -0500 (EST)

branch: externals/compat
commit 15288f4771999f640f8df6560d8623d773dfa312
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat-29: Add while-let test
---
 compat-29.el    | 2 +-
 compat-tests.el | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat-29.el b/compat-29.el
index 80588e0910..b330f33569 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -326,7 +326,7 @@ this defaults to the current buffer."
           (put-text-property sub-start sub-end 'display disp object)))
       (setq sub-start sub-end))))
 
-(compat-defmacro while-let (spec &rest body) ;; <UNTESTED>
+(compat-defmacro while-let (spec &rest body) ;; <OK>
   "Bind variables according to SPEC and conditionally evaluate BODY.
 Evaluate each binding in turn, stopping if a binding value is nil.
 If all bindings are non-nil, eval BODY and repeat.
diff --git a/compat-tests.el b/compat-tests.el
index e852d94118..d402eadded 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1539,6 +1539,12 @@
   (should-not (boundp 'compat-tests--dlet1))
   (should-not (boundp 'compat-tests--dlet2)))
 
+(ert-deftest while-let ()
+  (let ((first '(1 2 3 4)) (second '(a b c)) zipped)
+    (while-let ((x (pop first)) (y (pop second)))
+      (push (cons x y) zipped))
+    (should-equal '((3 . c) (2 . b) (1 . a)) zipped)))
+
 (ert-deftest when-let* ()
   (should-equal "second"
    (when-let*



reply via email to

[Prev in Thread] Current Thread [Next in Thread]