Commit 022e5da4 authored by ryszard.szopa's avatar ryszard.szopa
Browse files

new tests.

darcs-hash:4b51b3657ff6ada9c3c36f265c52362b58a442c0
parent 1fca8c7e
......@@ -67,8 +67,31 @@ metaclass set to HTML and the right connection-spec."
(finishes
(defdao-example bar ()
((foo :type foo :foreign t))))
(let ((class (find-class 'bar)))
(is (member class (submarine::db-class-unfinished-classes class)))
(defdao-example foo ()
((foo :type integer)))
(is-false (member class (submarine::db-class-unfinished-classes class)))))
(db-test (unresolved-references :depends-on dao-definition-with-foreign-key)
(defdao-example wrong-foo ()
((foreign-key :foreign t :accessor foreign-key :type bar :initarg :foreign :initform nil)))
(signals unresolved-foreign-key
(make-instance 'wrong-foo :foreign 1))
(signals unresolved-foreign-key
(make-and-save 'wrong-foo :foreign "foo"))
(setf (submarine::db-class-unfinished-classes nil)))
(db-test (get-all :depends-on dao-definition-with-foreign-key)
(defdao-example foo ()
((foo :type integer))))
((foo :type integer :initform 0)))
(defdao-example bar ()
((foo :type foo :foreign t :initarg :foo :accessor foo)))
(let ((the-foo (make-and-save 'foo :foo 1)))
(iter (for i from 1 to 10)
(make-and-save 'bar :foo the-foo))
(is (= 10 (length (get-all 'bar the-foo))))))
(db-test (many-to-many-definition :depends-on dao-definition-with-foreign-key)
(finishes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment