X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=tests%2Ftest-oodml.lisp;h=6278d73cd64e40f78bd2ef415072328127a3b69f;hp=953a604a9adc693a657e2185c66ccab3ce37ecef;hb=f2e97f7b39c1cf82b6f3d1cec9362e551761549e;hpb=0b35694f3659e5ee739ea72ce74d798c3f0ddb73 diff --git a/tests/test-oodml.lisp b/tests/test-oodml.lisp index 953a604..6278d73 100644 --- a/tests/test-oodml.lisp +++ b/tests/test-oodml.lisp @@ -17,10 +17,63 @@ (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* '( +(deftest :oodml/read-symbol-value/1-into-this-package + (clsql-sys::read-sql-value + (clsql-sys::database-output-sql-as-type 'symbol 'clsql-tests::foo nil nil) + 'symbol nil nil) + 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) + +(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) + +(deftest :oodml/read-symbol-value/4-keyword-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* (mapcar #'(lambda (e) (slot-value e 'last-name)) @@ -275,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*