Commit 595d83cd authored by ryszard.szopa's avatar ryszard.szopa
Browse files

new tests, dependencies between tests.

darcs-hash:fd7094fe4193d377187b68002bac9c922daeba22
parent e12d1e1c
......@@ -44,19 +44,33 @@ metaclass set to HTML and the right connection-spec."
(finishes (with-class-connection ((find-class 'class-connection))
(pomo::query "SELECT 1;"))))
(db-test dao-definition
(db-test (dao-definition :depends-on class-connection)
(finishes
(defdao-example foo ()
((foo :type integer)))))
(db-test dao-redefinition
(db-test (dao-redefinition :depends-on dao-definition)
(finishes
(defdao-example foo ()
((foo :type integer)))
(defdao-example foo ()
((foo :type integer)))))
(db-test (many-to-many-definition :depends-on dao-definition)
(db-test (dao-definition-with-foreign-key :depends-on dao-definition)
(defdao-example foo ()
((foo :type integer)))
(finishes
(defdao-example bar ()
((foo :type foo :foreign t)))))
(db-test (dao-definition-with-foreign-key-wrong-order :depends-on dao-definition-with-foreign-key)
(finishes
(defdao-example bar ()
((foo :type foo :foreign t))))
(defdao-example foo ()
((foo :type integer))))
(db-test (many-to-many-definition :depends-on dao-definition-with-foreign-key)
(finishes
(defdao-example foo ()
((foo :type integer)))
......@@ -64,7 +78,7 @@ metaclass set to HTML and the right connection-spec."
((bar :type integer)))
(defmany foo bar)))
(db-test many-to-many-redefinition
(db-test (many-to-many-redefinition :depends-on many-to-many-definition)
(finishes
(defdao-example foo ()
((foo :type integer)))
......@@ -73,6 +87,38 @@ metaclass set to HTML and the right connection-spec."
(defmany foo bar)
(defmany foo bar)))
(db-test (make-dao :depends-on dao-definition)
(defdao-example foo ()
((foo :type integer :initarg :foo :accessor foo)))
(finishes (make-instance 'foo :foo 1)))
(db-test (get-dao-from-db :depends-on make-dao)
(defdao-example foo ()
((foo :type integer :initarg :foo :accessor foo)))
(let ((instance (make-instance 'foo :foo 3)))
(finishes (save-dao instance))
(is (= (foo instance) (foo (make-instance 'foo :id (get-id instance)))))))
(db-test (select-dao :depends-on get-dao-from-db)
(defdao-example foo ()
((foo :type integer :initarg :foo :accessor foo)))
(iter (for i from 1 to 10)
(make-and-save 'foo :foo 3))
(let ((select (select-dao 'foo)))
(is (= (length select) 10))))
(db-test (select-dao-with-test :depends-on select-dao)
(defdao-example foo ()
((foo :type integer :initarg :foo :accessor foo)))
(iter (for i from 1 to 17)
(make-and-save 'foo :foo 17))
(iter (for i from 1 to 13)
(make-and-save 'foo :foo 13))
(is (= 13 (length (select-dao 'foo (:= 13 foo)))))
(is (= 17 (length (select-dao 'foo (:= 17 foo))))))
;;; Copyright (C) 2007
;;; Ryszard Szopa <ryszard.szopa@gmail.com> &
......
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