aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-02-21 13:56:56 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-02-21 13:59:59 +0000
commit0f8b5185fd3f3d0fa7d630a0da95b8b6ecb37435 (patch)
tree651d4550463e7bf2c994d24b80592a0247224a68 /tests
parentf908ed5952190af6090a5e7ef5c1d90d1214d999 (diff)
downloadcantedraw-0f8b5185fd3f3d0fa7d630a0da95b8b6ecb37435.tar.gz
cantedraw-0f8b5185fd3f3d0fa7d630a0da95b8b6ecb37435.tar.bz2
cantedraw-0f8b5185fd3f3d0fa7d630a0da95b8b6ecb37435.zip
Add unit tests for lib.macros.-<>
Diffstat (limited to 'tests')
-rw-r--r--tests/macros.lisp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/macros.lisp b/tests/macros.lisp
index ef9f8e5..5e0a1fb 100644
--- a/tests/macros.lisp
+++ b/tests/macros.lisp
@@ -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 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)))