From 0f8b5185fd3f3d0fa7d630a0da95b8b6ecb37435 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 21 Feb 2025 13:56:56 +0000 Subject: Add unit tests for lib.macros.-<> --- tests/macros.lisp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/macros.lisp') 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))) -- cgit v1.2.3-13-gbd6f