Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
basil-conto committed Apr 15, 2023
1 parent c30c6be commit b6eef1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dash.texi
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions dev/examples.el
Expand Up @@ -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)))

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6eef1a

Please sign in to comment.