From 1ec00c8b51feb1b07b79f9e6e6fe831aefd7d2bc Mon Sep 17 00:00:00 2001 From: Holger Schauer Date: Wed, 9 Mar 2011 19:14:43 +0100 Subject: [PATCH] Make some oodml/update-records tests more robust. :update-records/9 and 9-slots: handle case where selects fail. :update-records/9-slots: fix second update with list of slots needs to call update-records-from-slots not -from-slot. --- tests/test-oodml.lisp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test-oodml.lisp b/tests/test-oodml.lisp index 29b8059..f0d3d9b 100644 --- a/tests/test-oodml.lisp +++ b/tests/test-oodml.lisp @@ -554,6 +554,8 @@ (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) @@ -576,6 +578,8 @@ (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) @@ -585,6 +589,8 @@ (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) @@ -593,9 +599,11 @@ (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" -- 2.34.1