X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/dea4d05507e59ab779ed4bb209e05971d87e260c..bacaaec3a2ba7e5fdbc342045f74394bc5ffbbcf:/src/test-base.lisp diff --git a/src/test-base.lisp b/src/test-base.lisp index 6e020cb..915e33d 100644 --- a/src/test-base.lisp +++ b/src/test-base.lisp @@ -7,7 +7,7 @@ ;;;----- Licensing notice --------------------------------------------------- ;;; -;;; This file is part of the Sensble Object Design, an object system for C. +;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -45,14 +45,34 @@ :description "Top-level test for the Sod translator.")) (defun assert-princ (object string) - (let ((*print-right-margin* 77) - (print (princ-to-string object))) + (let* ((*print-right-margin* 77) + (*print-pretty* t) + (print (princ-to-string object))) (assert-equal print string (format nil "Assert princ: ~S ~_prints as `~A' ~_~ 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)) + +(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 --------------------------------------------------