aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNicolas Petton2015-05-01 19:30:56 +0200
committerNicolas Petton2015-05-01 19:33:40 +0200
commitc856843f6b83d4578e7fab3d9821802f2a542540 (patch)
tree4e4e2f43fb72bc7a83ff9c1b283d8048fa7a2579 /test
parentb0481de73be9fb7c4839340de2b494f19041130a (diff)
downloademacs-c856843f6b83d4578e7fab3d9821802f2a542540.tar.gz
emacs-c856843f6b83d4578e7fab3d9821802f2a542540.zip
New macro seq-let, providing destructuring support to seq.el
* lisp/emacs-lisp/seq.el (seq-let): New macro. `seq-let' is similar to `cl-destructuring-bind' but works on all sequence types supported by `seq.el'. Bump version number to 1.6. * test/automated/seq-tests.el: Add tests for seq-let. * doc/lispref/sequences.texi: Add documentation for seq-let.
Diffstat (limited to 'test')
-rw-r--r--test/automated/seq-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index 7f6e06cc4b6..e1e8ae002d0 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -276,5 +276,22 @@ Evaluate BODY for each created sequence.
276 (v2 [2 4 6])) 276 (v2 [2 4 6]))
277 (should (seq-empty-p (seq-difference v1 v2))))) 277 (should (seq-empty-p (seq-difference v1 v2)))))
278 278
279(ert-deftest test-seq-let ()
280 (with-test-sequences (seq '(1 2 3 4))
281 (seq-let (a b c d e) seq
282 (should (= a 1))
283 (should (= b 2))
284 (should (= c 3))
285 (should (= d 4))
286 (should (null e))))
287 (let ((seq '(1 (2 (3 (4))))))
288 (seq-let (_ (_ (_ (a)))) seq
289 (should (= a 4))))
290 (let (seq)
291 (seq-let (a b c) seq
292 (should (null a))
293 (should (null b))
294 (should (null c)))))
295
279(provide 'seq-tests) 296(provide 'seq-tests)
280;;; seq-tests.el ends here 297;;; seq-tests.el ends here