+;;; Test how we apply logical operators when we have different numbers of children
+;;; This is useful if we wish to (apply #'sql-and some-list) without having to do
+;;; alot of length checking
+(deftest :syntax/logical/3
+ (values (clsql:sql [and ])
+ (clsql:sql [and [foo]])
+ (clsql:sql [and [not [foo]]])
+ (clsql:sql [and [foo] [bar] [baz]]))
+ ""
+ "FOO"
+ "(NOT (FOO))"
+ "(FOO AND BAR AND BAZ)")
+
+(deftest :syntax/logical/4
+ (clsql:sql [and [= [foo] [bar]]])
+ "(FOO = BAR)")
+
+(deftest :syntax/logical/5
+ (clsql:sql [and [= [foo] [bar]]
+ [= [bar] [bast]]
+ [= [block] [blech]]])
+ "((FOO = BAR) AND (BAR = BAST) AND (BLOCK = BLECH))")
+
+(deftest :syntax/logical/6
+ (clsql:sql
+ (apply #'sql-and
+ (list [= [foo] [bar]]
+ [and ]
+ [and [= [bar] [bast]]])))
+ "((FOO = BAR) AND (BAR = BAST))")