Browse files

convered orphan sql-ident-table test function to use RT and run with

the rest of the syntax tests (and fail)

Had to fix some package references, and uses backquote to splice
together the a decent deftest form without being overly verbose. Also
used clsql:sql instead of calling output-sql directly.

Currently fails by not preserving case when using a symbol like '|foo|
as the table name, we're getting "FOO" not "foo".
  • Loading branch information...
1 parent 85508ad commit b0b0c67955ef0ec3f6a4708b79abe86d53359092 @ryepup ryepup committed Mar 27, 2012
Showing with 18 additions and 15 deletions.
  1. +18 −15 tests/test-syntax.lisp
@@ -445,18 +445,21 @@
-(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))))
+(let ((tests '(((:foo) "FOO")
+ ((:foo-bar) "FOO_BAR")
+ (("foo") "\"foo\"")
+ (('|foo bar|) "\"foo bar\"")
+ ((:foo :table-alias :bar) "FOO BAR" )
+ ((:foo_bar :table-alias :bar-bast) "FOO_BAR BAR_BAST")
+ (("foo" :table-alias "Bar") "\"foo\" \"Bar\"")
+ (('|foo bar| :table-alias :bast) "\"foo bar\" BAST"))))
+ (push
+ `(deftest :syntax/sql-ident-table
+ (values ,@(mapcar
+ #'(lambda (args)
+ `(clsql:sql (make-instance 'clsql-sys:sql-ident-table
+ :name ,@args)))
+ (mapcar #'first tests)))
+ ,@(mapcar #'second tests))
+ *rt-syntax*))

0 comments on commit b0b0c67

Please sign in to comment.