X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=tests%2Ftest-syntax.lisp;h=04ea99cbe1c3857383fe98d3b6face4079c285ad;hp=8d1a86382a668680e53dba26247753cb3941dbe9;hb=d9f41af62750c622945bb17b622a39689ee5b840;hpb=21ffe5f820036726c6353a16dfb478fb41aa700c diff --git a/tests/test-syntax.lisp b/tests/test-syntax.lisp index 8d1a863..04ea99c 100644 --- a/tests/test-syntax.lisp +++ b/tests/test-syntax.lisp @@ -40,6 +40,9 @@ (clsql:sql ["SELECT FOO,BAR FROM BAZ"]) "SELECT FOO,BAR FROM BAZ") +(deftest :syntax/generic/6 + (clsql:sql "What's up Doc?") + "'What''s up Doc?'") (deftest :syntax/ident/1 (clsql:sql [foo]) @@ -73,7 +76,7 @@ (deftest :syntax/subquery/1 (clsql:sql [any '(3 4)]) - "(ANY ((3,4)))") + "ANY((3,4))") (deftest :syntax/subquery/2 (clsql:sql [in [foo] '(foo bar baz)]) @@ -81,15 +84,15 @@ (deftest :syntax/subquery/3 (clsql:sql [all '(foo bar baz)]) - "(ALL ((FOO,BAR,BAZ)))") + "ALL((FOO,BAR,BAZ))") (deftest :syntax/subquery/4 (clsql:sql [exists '(foo bar baz)]) - "(EXISTS ((FOO,BAR,BAZ)))") + "EXISTS((FOO,BAR,BAZ))") (deftest :syntax/subquery/5 (clsql:sql [some '(foo bar baz)]) - "(SOME ((FOO,BAR,BAZ)))") + "SOME((FOO,BAR,BAZ))") (deftest :syntax/aggregate/1 @@ -206,6 +209,10 @@ (deftest :syntax/substr/1 (clsql:sql [substr [hello] 1 4]) + "SUBSTR(HELLO,1,4)") + +(deftest :syntax/substring/1 + (clsql:sql [substring [hello] 1 4]) "SUBSTRING(HELLO,1,4)") @@ -213,6 +220,10 @@ (clsql:sql [|| [foo] [bar] [baz]]) "(FOO || BAR || BAZ)") +(deftest :syntax/concat/2 + (clsql:sql [concat [foo] [bar]]) + "CONCAT(FOO,BAR)") + (deftest :syntax/pattern/1 (clsql:sql [like [foo] "%v"]) @@ -241,6 +252,20 @@ "GROUP BY FOO") +(deftest :syntax/coalesce/1 + (clsql:sql [coalesce [foo] [bar] "not specified"]) + "COALESCE(FOO,BAR,'not specified')") + +(deftest :syntax/coalesce/2 + (clsql:sql [nvl [foo] "not specified"]) + "COALESCE(FOO,'not specified')") + +(deftest :syntax/nvl/1 + (clsql:sql [nvl [foo] "not specified"]) + "COALESCE(FOO,'not specified')") + + + (deftest :syntax/sets/1 (clsql:sql [union [select [foo] :from [bar]] [select [baz] :from [bar]]]) "SELECT FOO FROM BAR UNION SELECT BAZ FROM BAR") @@ -253,6 +278,10 @@ (clsql:sql [except [select [foo] :from [bar]] [select [baz] :from [bar]]]) "SELECT FOO FROM BAR EXCEPT SELECT BAZ FROM BAR") +(deftest :syntax/sets/4 + (clsql:sql [minus [select [foo] :from [bar]] [select [baz] :from [bar]]]) + "SELECT FOO FROM BAR MINUS SELECT BAZ FROM BAR") + (deftest :syntax/function/1 (clsql:sql [function "COS" [age]])