X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-syntax.lisp;h=6cb1c0c1ce1d26df8a76f39b4ba234d18fd23673;hb=refs%2Ftags%2Fdebian-5.2.0-1;hp=65efd9830bf414e2ede51e8290e6c9720a8d0ce7;hpb=29184a377bfebf51266104aadafc5fe422cbd791;p=clsql.git diff --git a/tests/test-syntax.lisp b/tests/test-syntax.lisp index 65efd98..6cb1c0c 100644 --- a/tests/test-syntax.lisp +++ b/tests/test-syntax.lisp @@ -409,4 +409,20 @@ )) +(defun test-output-sql/sql-ident-table () + (let ((tests `((,(make-instance 'sql-ident-table :name :foo) "FOO") + (,(make-instance 'sql-ident-table :name :foo-bar) "FOO_BAR") + (,(make-instance 'sql-ident-table :name "foo") "\"foo\"") + (,(make-instance 'sql-ident-table :name '|foo bar|) "\"foo bar\"") + (,(make-instance 'sql-ident-table :name :foo :table-alias :bar) "FOO BAR" ) + (,(make-instance 'sql-ident-table :name :foo_bar :table-alias :bar-bast) "FOO_BAR BAR_BAST") + (,(make-instance 'sql-ident-table :name "foo" :table-alias "Bar") "\"foo\" \"Bar\"") + (,(make-instance 'sql-ident-table :name '|foo bar| :table-alias :bast) "\"foo bar\" BAST")))) + (loop for (test expected-result) in tests + for test-out = (with-output-to-string (*sql-stream*) (output-sql test nil)) + do (assert (string-equal test-out expected-result) + (test test-out expected-result) + "Test:~s didnt match ~S" + test-out expected-result)))) + #.(clsql:restore-sql-reader-syntax-state)