X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-oodml.lisp;h=6278d73cd64e40f78bd2ef415072328127a3b69f;hb=f2e97f7b39c1cf82b6f3d1cec9362e551761549e;hp=63e1d50c89d62719167f76b53a5ed247d22fb911;hpb=31ae82f1e0aefcdd11a25239b6fb21c13d38d9f2;p=clsql.git diff --git a/tests/test-oodml.lisp b/tests/test-oodml.lisp index 63e1d50..6278d73 100644 --- a/tests/test-oodml.lisp +++ b/tests/test-oodml.lisp @@ -17,6 +17,13 @@ (clsql-sys:file-enable-sql-reader-syntax) +(defmacro has-sql-value-conversion-error (() &body body) + `(let (*debugger-hook*) + (handler-case + (progn ,@body nil) + (clsql-sys::sql-value-conversion-error (c) + (declare (ignore c)) + t)))) (setq *rt-oodml* '( @@ -25,28 +32,47 @@ (clsql-sys::read-sql-value (clsql-sys::database-output-sql-as-type 'symbol 'clsql-tests::foo nil nil) 'symbol nil nil) - '(clsql-tests::foo)) + clsql-tests::foo) (deftest :oodml/read-symbol-value/2-into-another-pacakge (clsql-sys::read-sql-value (clsql-sys::database-output-sql-as-type 'symbol 'clsql-sys::foo nil nil) 'symbol nil nil) - '(clsql-sys::foo)) + clsql-sys::foo) (deftest :oodml/read-symbol-value/3-keyword (clsql-sys::read-sql-value (clsql-sys::database-output-sql-as-type 'keyword ':foo nil nil) 'keyword nil nil) - '(:foo)) + :foo) (deftest :oodml/read-symbol-value/4-keyword-error - (handler-case - (clsql-sys::read-sql-value - (clsql-sys::database-output-sql-as-type 'keyword 'foo nil nil) - 'keyword nil nil) - (clsql-sys::sql-value-conversion-error (c) (declare (ignore c)) - :error)) - '(:error)) + (has-sql-value-conversion-error () + (clsql-sys::read-sql-value + (clsql-sys::database-output-sql-as-type 'keyword 'foo nil nil) + 'keyword nil nil)) + T) + +(deftest :oodml/read-symbol-value/5-unknown-type-error-1 + (has-sql-value-conversion-error () + (clsql-sys::read-sql-value + (clsql-sys::database-output-sql-as-type 'bloop 'foo nil nil) + 'bloop nil nil)) + t) + +(deftest :oodml/read-symbol-value/6-unknown-type-error-2 + (has-sql-value-conversion-error () + (clsql-sys::read-sql-value + (clsql-sys::database-output-sql-as-type 'bloop 'foo nil nil) + '(or integer float) nil nil)) + t) + +(deftest :oodml/read-symbol-value/read-list + (clsql-sys::read-sql-value + (clsql-sys::database-output-sql-as-type + 'list '(("status" "new" "open")) nil nil) + 'list nil nil) + (("status" "new" "open"))) (deftest :oodml/select/1 (with-dataset *ds-employees* @@ -302,6 +328,14 @@ (select 'deferred-employee-address :flatp t :order-by [aaddressid] :caching nil))) (10 10 nil nil nil nil)) +(deftest :oodm/retrieval/10-slot-columns + (with-dataset *ds-employees* + (mapcar #'title + (select 'employee :flatp t :caching nil + :where [<= [emplid] 3] + :order-by `((,[emplid] :asc))))) + (supplicant :adherent cl-user::novice)) + ;; tests update-records-from-instance (deftest :oodml/update-records/1 (with-dataset *ds-employees*