projects
/
clsql.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix reader conditional
[clsql.git]
/
tests
/
test-oodml.lisp
diff --git
a/tests/test-oodml.lisp
b/tests/test-oodml.lisp
index d1c933a432d75c8340b047651fbe092590457efa..f0d3d9b9e98baed6c1e9aaee674abb503d09dfe1 100644
(file)
--- a/
tests/test-oodml.lisp
+++ b/
tests/test-oodml.lisp
@@
-216,6
+216,8
@@
(length (clsql:select 'artist :flatp t :caching nil)))
0)
(length (clsql:select 'artist :flatp t :caching nil)))
0)
+
+
;; test retrieval is deferred
(deftest :oodm/retrieval/1
(with-dataset *ds-employees*
;; test retrieval is deferred
(deftest :oodm/retrieval/1
(with-dataset *ds-employees*
@@
-304,15
+306,16
@@
;; tests update-record-from-slot
(deftest :oodml/update-records/2
(with-dataset *ds-employees*
;; tests update-record-from-slot
(deftest :oodml/update-records/2
(with-dataset *ds-employees*
+ ;(start-sql-recording :type :both)
(values
(employee-email
(car (clsql:select 'employee
:where [= 1 [slot-value 'employee 'emplid]]
:flatp t
:caching nil)))
(values
(employee-email
(car (clsql:select 'employee
:where [= 1 [slot-value 'employee 'emplid]]
:flatp t
:caching nil)))
- (progn
- (setf (slot-value employee1 'email) "lenin-nospam@soviet.org")
- (clsql:update-record-from-slot employee1 'email)
+ (progn
+ (setf (slot-value employee1 'email) "lenin-nospam@soviet.org")
+ (clsql:update-record-from-slot employee1 'email)
(employee-email
(car (clsql:select 'employee
:where [= 1 [slot-value 'employee 'emplid]]
(employee-email
(car (clsql:select 'employee
:where [= 1 [slot-value 'employee 'emplid]]
@@
-551,6
+554,8
@@
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "Couldn't find expected sublocation"))
(format nil "~a ~a ~a"
(slot-value sl 'subloc-id)
(slot-value sl 'title)
(format nil "~a ~a ~a"
(slot-value sl 'subloc-id)
(slot-value sl 'title)
@@
-573,6
+578,8
@@
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "In psfl: found no sublocation with id = 10"))
(format nil "~a ~a ~a"
(slot-value sl 'subloc-id)
(slot-value sl 'title)
(format nil "~a ~a ~a"
(slot-value sl 'subloc-id)
(slot-value sl 'title)
@@
-582,6
+589,8
@@
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "Select for modification: Found no sublocation with id = 10"))
(setf (slot-value sl 'title) "Altered subloc title")
(setf (slot-value sl 'loc) "Altered loc")
(clsql:update-record-from-slot sl 'title)
(setf (slot-value sl 'title) "Altered subloc title")
(setf (slot-value sl 'loc) "Altered loc")
(clsql:update-record-from-slot sl 'title)
@@
-590,9
+599,11
@@
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
(let ((sl (car (clsql:select 'subloc
:where [= 10 [slot-value 'subloc 'subloc-id]]
:flatp t :caching nil))))
+ (unless sl
+ (error "Select for next modification: Found no sublocation with id = 10"))
(setf (slot-value sl 'title) "subloc-1")
(setf (slot-value sl 'loc) "a subloc")
(setf (slot-value sl 'title) "subloc-1")
(setf (slot-value sl 'loc) "a subloc")
- (clsql:update-record-from-slot sl '(title loc))
+ (clsql:update-record-from-slot
s
sl '(title loc))
(print-fresh-subloc)))))
"10 subloc-1 a subloc"
"10 Altered subloc title Altered loc"
(print-fresh-subloc)))))
"10 subloc-1 a subloc"
"10 Altered subloc title Altered loc"
@@
-625,6
+636,12
@@
(list (name artist1) (artist_id artist1)))
("Mogwai" 1))
(list (name artist1) (artist_id artist1)))
("Mogwai" 1))
+(deftest :oodml/update-records/12
+ (with-dataset *ds-artists*
+ (clsql:update-records-from-instance artist1)
+ (list (name artist1) (genre artist1)))
+ ("Mogwai" "Unknown"))
+
;; tests update-instance-from-records
(deftest :oodml/update-instance/1
(with-dataset *ds-employees*
;; tests update-instance-from-records
(deftest :oodml/update-instance/1
(with-dataset *ds-employees*