;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: assert.lisp,v 1.9 2003/08/08 00:57:20 kevin Exp $
+;;;; ID: $Id: assert.lisp,v 1.10 2003/08/10 07:39:33 kevin Exp $
;;;; Purpose: Assert functions for XLUnit
;;;;
;;;; *************************************************************************
(defun assert-eql (v1 v2 &optional message)
(unless (eql v1 v2)
- (failure-message message "Assert eql: ~S ~S" v1 v2)))
+ (failure-message message "Assert equal: ~S ~S" v1 v2)))
(defun assert-not-eql (v1 v2 &optional message)
(when (eql v1 v2)
`(when ,v
(failure-message ,message "Assert false: ~S" ',v)))
-(defmacro assert-condition (condition forms &optional message)
+(defmacro assert-condition (condition form &optional message)
(let ((cond (gensym "COND-")))
`(handler-case
(progn
- ,forms
+ ,form
(values))
(t (,cond)
(when (and (typep ,cond 'serious-condition)
"Assert condition ~A, but no condition signaled"
,condition)))))
-(defmacro assert-not-condition (condition forms &optional message)
+(defmacro assert-not-condition (condition form &optional message)
(let ((cond (gensym "COND-")))
`(handler-case
(progn
- ,forms
+ ,form
(values))
(serious-condition (,cond)
(unless (typep ,cond ,condition)
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: package.lisp,v 1.11 2003/08/08 00:57:20 kevin Exp $
+;;;; ID: $Id: package.lisp,v 1.12 2003/08/10 07:39:33 kevin Exp $
;;;; Purpose: Package definition for XLUnit
;;;;
-;;;; $Id: package.lisp,v 1.11 2003/08/08 00:57:20 kevin Exp $
+;;;; $Id: package.lisp,v 1.12 2003/08/10 07:39:33 kevin Exp $
;;;; *************************************************************************
(in-package #:cl-user)
;; assert
#:assert-equal
+ #:assert-eql
+ #:assert-not-eql
#:assert-true
#:assert-false
+ #:assert-condition
#:test
#:test-error
#:test-no-error
#:remove-test
#:tests
#:get-suite
+ #:suite
#:test-suite
#:run-on-test-results
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: printer.lisp,v 1.6 2003/08/05 22:56:25 kevin Exp $
+;;;; ID: $Id: printer.lisp,v 1.7 2003/08/10 07:39:33 kevin Exp $
;;;; Purpose: Printer functions for XLUnit
;;;;
;;;; *************************************************************************
(let ((count (length defects)))
(if (= 1 count)
(format (ostream obj) "~%There was 1 ~A:~%" title)
- (format (ostream obj) "~%There were ~D A:~%"
+ (format (ostream obj) "~%There were ~D ~A:~%"
count title))
(dotimes (i count)
(let* ((defect (nth i defects))
(condition (thrown-condition defect)))
(format (ostream obj) "~A) ~A: "
(1+ i) (name (failed-test defect)))
- (apply #'format (ostream obj)
- (simple-condition-format-control condition)
- (simple-condition-format-arguments condition))
- (format (ostream obj) "~%")
- (when (message condition)
- (let ((spaces (+ 2 (length (format nil "~D" count)))))
- (dotimes (i spaces)
- (write-char #\space (ostream obj))))
- (format (ostream obj) "~A~%" (message condition))))))))
+ (typecase condition
+ (assertion-failed
+ (apply #'format (ostream obj)
+ (simple-condition-format-control condition)
+ (simple-condition-format-arguments condition))
+ (format (ostream obj) "~%")
+ (when (message condition)
+ (let ((spaces (+ 2 (length (format nil "~D" count)))))
+ (dotimes (i spaces)
+ (write-char #\space (ostream obj))))
+ (format (ostream obj) "~A~%" (message condition))))
+ (t
+ (format (ostream obj) "~A~%" condition))))))))
(defmethod print-footer ((obj textui-test-runner) result)
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: result.lisp,v 1.7 2003/08/05 22:56:25 kevin Exp $
+;;;; ID: $Id: result.lisp,v 1.8 2003/08/10 07:39:33 kevin Exp $
;;;; Purpose: Result functions for XLUnit
;;;;
;;;; *************************************************************************
(defmethod start-test ((tcase test) (res test-results))
(incf (run-tests res))
- (mapc (lambda (listener) (start-test listener tcase)) (listeners res))
+ (mapc (lambda (listener)
+ (start-test listener tcase))
+ (listeners res))
res)
(defmethod end-test ((tcase test) (res test-results))
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; Id: $Id: tests.lisp,v 1.14 2003/08/08 00:57:20 kevin Exp $
+;;;; Id: $Id: tests.lisp,v 1.15 2003/08/10 07:39:33 kevin Exp $
;;;; Purpose: Self Test suite for XLUnit
;;;;
;;;; *************************************************************************
(def-test-method test-condition-without-cond ((self was-run) :run nil)
(assert-condition 'error (list 'no-error)))
+#+ignore
(def-test-method test-not-condition-with-cond ((self was-run) :run nil)
(assert-not-condition 'test-condition
(signal 'test-condition)))
(def-test-method test-condition ((self test-case-test) :run nil)
(assert-condition
'test-condition
- (error (make-instance 'test-condition))))
+ (error 'test-condition)))
(def-test-method test-condition-without-cond ((self test-case-test)
:run nil)
(summary (run
(named-test 'test-condition-without-cond
(get-suite was-run))))))
-
+
+#+ignore
(def-test-method test-not-condition ((self test-case-test) :run nil)
(assert-not-condition
'test-condition
(progn)))
+#+ignore
(def-test-method test-not-condition-with-cond ((self test-case-test)
:run nil)
(assert-equal "1 run, 0 erred, 1 failed"
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; ID: $Id: textui.lisp,v 1.2 2003/08/04 17:04:50 kevin Exp $
+;;;; ID: $Id: textui.lisp,v 1.3 2003/08/10 07:39:33 kevin Exp $
;;;; Purpose: Text UI for Test Runner
;;;;
;;;; *************************************************************************
(run-on-test-results ob result)
(print-results test-runner result
(/ (- (get-internal-real-time) start-time)
- internal-time-units-per-second))))
-
+ internal-time-units-per-second))
+ result))
;;;; Programmer: Kevin M. Rosenberg
;;;; Date Started: Aug 2003
;;;;
-;;;; $Id: xlunit.asd,v 1.8 2003/08/08 00:57:20 kevin Exp $
+;;;; $Id: xlunit.asd,v 1.9 2003/08/10 07:39:33 kevin Exp $
;;;; *************************************************************************
(defpackage #:xlunit-system (:use #:asdf #:cl))
))
(defmethod perform ((o test-op) (c (eql (find-system 'xlunit))))
- (operate 'load-op 'xlunit-tests :force t)
+ (operate 'load-op 'xlunit-tests)
(operate 'test-op 'xlunit-tests :force t))
(defsystem xlunit-tests