test/chimaera.sod: Use the macros for sending messages.
[sod] / src / test-base.lisp
index 6e020cb..f7210ab 100644 (file)
                               rather than `~A'."
                          object print string))))
 
-(defun run-tests ()
-  (textui-test-run *sod-test-suite*))
+(defclass base-test (test-case) ())
+(add-test *sod-test-suite* (get-suite base-test))
+
+(export '*build-version*)
+(defvar *build-version* nil)
+
+(def-test-method check-version ((test base-test) :run nil)
+  (unless (or (null *build-version*)
+             (and (>= (length *build-version*) (length *sod-version*))
+                  (string= *build-version* *sod-version*
+                           :end1 (length *sod-version*))))
+    (failure "Build version ~A doesn't match package version ~A."
+            *build-version* *sod-version*)))
+
+(defun run-tests (&optional which)
+  (textui-test-run (acond
+                    ((null which) *sod-test-suite*)
+                    ((labels ((dredge (suite)
+                                (cond
+                                  ((typep suite 'test-suite)
+                                   (some #'dredge (tests suite)))
+                                  ((eq (xlunit::name suite) which)
+                                   suite)
+                                  (t
+                                   nil))))
+                       (dredge *sod-test-suite*))
+                     it)
+                    ((find-class which nil)
+                     (suite (make-instance it)))
+                    (t
+                     (error "Don't know how to turn ~S into a test suite"
+                            which)))))
 
 ;;;----- That's all, folks --------------------------------------------------