lib/lisp/tests/destructuring-examples.nydp in nydp-0.3.0 vs lib/lisp/tests/destructuring-examples.nydp in nydp-0.4.0
- old
+ new
@@ -14,11 +14,11 @@
(destructure/with 'xxx '(a (b c) (d (e f)) g . h) 0)
(a (nth 0 xxx)
(b c) (nth 1 xxx)
(d (e f)) (nth 2 xxx)
g (nth 3 xxx)
- h (lastcdr xxx))))
+ h (nthcdr 4 xxx))))
(examples-for destructure/build
("with no args"
(destructure/build nil nil '(x))
(fn nil x))
@@ -53,9 +53,26 @@
(fn (destructure-1 d . e)
((fn (a destructure-2)
((fn (b c) x)
(nth 0 destructure-2)
(nth 1 destructure-2))) (nth 0 destructure-1) (nth 1 destructure-1))))
+
+ ("nested improper arguments"
+ (let (a (b c . d) e) (list "A" (list "B" "C" "D0" "D1" "D2") "E")
+ (string-pieces a b c d e))
+ "ABCD0D1D2E")
+
+ ; a lot of ceremony here to suppress side-effects of compiling really crap code and just get the warnings
+ ("warns about arg names shadowing macro names"
+ (do (without-hooks 'warnings/new
+ λ(on-err nil
+ (pre-compile '(fun (aif (and or) . when)
+ "ignore"))))
+ warnings/list)
+ ((arg-shadows-macro "arg " when " shadows macro " when " in arg list " (aif (and or) . when))
+ (arg-shadows-macro "arg " or " shadows macro " or " in arg list " (aif (and or) . when))
+ (arg-shadows-macro "arg " and " shadows macro " and " in arg list " (aif (and or) . when))
+ (arg-shadows-macro "arg " aif " shadows macro " aif " in arg list " (aif (and or) . when))))
("implicit in 'let and 'with"
(with ((a b) (list "h" "e")
(c (d e f)) (list "l" (list "l" "o" " ")))
(let (g (h (i j) k)) (list "w" (list "o" (list "r" "l") "d"))