Add unit tests for lib.macros.-<>
This commit is contained in:
@@ -44,3 +44,21 @@
|
|||||||
(is equal `(,a (,b (,c ,d))) (macroexpand `(->> ,d (,c) (,b) (,a))))
|
(is equal `(,a (,b (,c ,d))) (macroexpand `(->> ,d (,c) (,b) (,a))))
|
||||||
(is equal `(,a (,b (,c ,d))) (macroexpand `(->> ,d ,c ,b ,a))))
|
(is equal `(,a (,b (,c ,d))) (macroexpand `(->> ,d ,c ,b ,a))))
|
||||||
(is string= "Hello, World!" (->> "world!" (format nil "hello, ~a") string-capitalize)))
|
(is string= "Hello, World!" (->> "world!" (format nil "hello, ~a") string-capitalize)))
|
||||||
|
|
||||||
|
(define-test (macro-test "-<>")
|
||||||
|
(true (null (-<>)))
|
||||||
|
(let ((a (gensym))
|
||||||
|
(b (gensym))
|
||||||
|
(c (gensym))
|
||||||
|
(d (gensym)))
|
||||||
|
(is eq a (-<> a))
|
||||||
|
(is equal `(,a ,b) (macroexpand `(-<> ,b (,a))))
|
||||||
|
(is equal `(,a ,b) (macroexpand `(-<> ,b ,a)))
|
||||||
|
(is equal `(,a (,b ,c)) (macroexpand `(-<> ,c (,b) (,a))))
|
||||||
|
(is equal `(,a (,b ,c)) (macroexpand `(-<> ,c ,b ,a)))
|
||||||
|
(is equal `(,a ,b ,c) (macroexpand `(-<> ,b (,a ,c))))
|
||||||
|
(is equal `(,a (,b (,c ,d))) (macroexpand `(-<> ,d (,c) (,b) (,a))))
|
||||||
|
(is equal `(,a (,b (,c ,d))) (macroexpand `(-<> ,d ,c ,b ,a)))
|
||||||
|
(is equal `(,a (,b ,c) ,d) (macroexpand `(-<> ,c (,b) (,a ,d)))))
|
||||||
|
(is equal 69 (-<> 489 (- 420)))
|
||||||
|
(is string= "HELLO" (-<> "Hello World!" (subseq 0 5) string-upcase)))
|
||||||
|
|||||||
Reference in New Issue
Block a user