From b6eef1a24dfbe57ba72d5eb1613fc05ff92e8e92 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 16 Apr 2023 00:24:01 +0100 Subject: [PATCH] Fix some tests * dev/examples.el (-splice, -iterate): Pacify new unused result warnings for side-effecting forms. (-clone): Actually showcase deep -clone, not shallow -copy. Avoid modifying constant literal. * README.md: * dash.texi: Regenerate docs. --- README.md | 2 +- dash.texi | 4 ++-- dev/examples.el | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index be00774f..ad06a584 100644 --- a/README.md +++ b/README.md @@ -2467,7 +2467,7 @@ replaced with new ones. This is useful when you need to clone a structure such as plist or alist. ```el -(let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) ;; => (1 2 3) +(let* ((a (list (list 1))) (b (-clone a))) (setcar (car a) 2) b) ;; => ((1)) ``` ## Threading macros diff --git a/dash.texi b/dash.texi index 4497ec8e..da7318db 100644 --- a/dash.texi +++ b/dash.texi @@ -3714,8 +3714,8 @@ structure such as plist or alist. @example @group -(let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) - @result{} (1 2 3) +(let* ((a (list (list 1))) (b (-clone a))) (setcar (car a) 2) b) + @result{} ((1)) @end group @end example @end defun diff --git a/dev/examples.el b/dev/examples.el index 5c93c10b..ad7afbcb 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -165,7 +165,7 @@ new list." ;; Test for destructive modification. (let ((l1 (list 1 2 3)) (l2 (list 4 5 6))) - (--splice (= it 2) l2 l1) + (ignore (--splice (= it 2) l2 l1)) (list l1 l2)) => '((1 2 3) (4 5 6))) @@ -824,10 +824,10 @@ value rather than consuming a list to produce a single value." (--iterate nil nil 1) => '(nil) (--iterate nil nil 2) => '(nil nil) (--iterate (setq it -1) 1 3) => '(1 -1 -1) - (let (l) (--iterate (push 1 l) (push 0 l) -1) l) => () - (let (l) (--iterate (push 1 l) (push 0 l) 0) l) => () - (let (l) (--iterate (push 1 l) (push 0 l) 1) l) => '(0) - (let (l) (--iterate (push 1 l) (push 0 l) 2) l) => '(1 0)) + (let (l) (ignore (--iterate (push 1 l) (push 0 l) -1)) l) => () + (let (l) (ignore (--iterate (push 1 l) (push 0 l) 0)) l) => () + (let (l) (ignore (--iterate (push 1 l) (push 0 l) 1)) l) => '(0) + (let (l) (ignore (--iterate (push 1 l) (push 0 l) 2)) l) => '(1 0)) (defexamples -unfold (-unfold (lambda (x) (unless (= x 0) (cons x (1- x)))) 10) => '(10 9 8 7 6 5 4 3 2 1) @@ -2013,7 +2013,7 @@ related predicates." => "{elisp-mode : {foo : {bar -> booze}, baz -> qux}, c-mode : {foo -> bla, bum -> bam}}") (defexamples -clone - (let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) => '(1 2 3))) + (let* ((a (list (list 1))) (b (-clone a))) (setcar (car a) 2) b) => '((1)))) (def-example-group "Threading macros" "Macros that conditionally combine sequential forms for brevity