-;;; Test Runners
-
-(defmethod text-testrunner ((suite test-suite) &key (stream t)
- (handle-errors t))
- (let* ((start-time (get-internal-real-time))
- (result (run-test suite :handle-errors handle-errors))
- (seconds (/ (- (get-internal-real-time) start-time)
- internal-time-units-per-second)))
- (result-printer result seconds stream)))
-
+;----------------------------------------------------------------------
+; macro def-test-method
+;
+; Creates the representation of a test method (included within a
+; test-case object) and add it to the corresponding suite class.
+; => clos version of the pluggable selector pattern
+;
+; use: (def-test-method test-assert-false (clos-unit-test)
+; (assert-true (eql (+ 1 2) 4) "comment"))
+;
+; new: it calls the textui-test-run function during eval, so to
+; allow the usual lisp-like incremental developing and test.
+;----------------------------------------------------------------------
+
+(defmacro def-test-method (method-name class-name &body method-body)
+ `(let ((,(caar class-name)
+ (make-instance ',(cadar class-name)
+ :name ',method-name)))
+ (setf (method-body ,(caar class-name))
+ #'(lambda() ,@method-body))
+ (add-test (suite ,(caar class-name)) ,(caar class-name))
+ (textui-test-run ,(caar class-name))))
+