aboutsummaryrefslogtreecommitdiff
path: root/tests/macros.lisp
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-02-21 13:56:39 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-02-21 13:59:55 +0000
commitf908ed5952190af6090a5e7ef5c1d90d1214d999 (patch)
treef870b539bc82dd4632d80c4825acb7859e5d0ad3 /tests/macros.lisp
parentdc1f3d89706d8a038747b065110546c9351e7796 (diff)
downloadcantedraw-f908ed5952190af6090a5e7ef5c1d90d1214d999.tar.gz
cantedraw-f908ed5952190af6090a5e7ef5c1d90d1214d999.tar.bz2
cantedraw-f908ed5952190af6090a5e7ef5c1d90d1214d999.zip
Add unit tests for lib.macros.->>
Diffstat (limited to 'tests/macros.lisp')
-rw-r--r--tests/macros.lisp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/macros.lisp b/tests/macros.lisp
index e86fbb3..ef9f8e5 100644
--- a/tests/macros.lisp
+++ b/tests/macros.lisp
@@ -27,3 +27,20 @@
(is eq 2 (--> x 1 (1+ x)))
(is eq 2 (--> x 1 1+))
(is string= "World!" (--> _ "Hello" (format nil "~a World!" _) (subseq _ 6))))
+
+(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 `(->> ,c (,a ,b))))
+ (is equal `(,a ,b (,c ,d)) (macroexpand `(->> (,c ,d) (,a ,b))))
+ (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)))