Make some oodml/update-records tests more robust. :update-records/9 and 9-slots:...
authorHolger Schauer <Holger.Schauer@gmx.de>
Wed, 9 Mar 2011 18:14:43 +0000 (19:14 +0100)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 30 Mar 2011 00:20:06 +0000 (18:20 -0600)
tests/test-oodml.lisp

index 29b80592a9f75948a8cfe8478ca85dc0513ea077..f0d3d9b9e98baed6c1e9aaee674abb503d09dfe1 100644 (file)
               (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)
               (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)
          (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)
          (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")
-           (clsql:update-record-from-slot sl '(title loc))
+           (clsql:update-record-from-slots sl '(title loc))
            (print-fresh-subloc)))))
   "10 subloc-1 a subloc"
   "10 Altered subloc title Altered loc"