X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=result.lisp;fp=result.lisp;h=ba95e4a00eb7658075ed9a9bc51fd6704781c1f9;hb=318cda1a328e9d99af2270c73cb13262e485a1ff;hp=0000000000000000000000000000000000000000;hpb=bee53ea40ad9caeeed1e7392d1f59127df7512ac;p=xlunit.git diff --git a/result.lisp b/result.lisp new file mode 100644 index 0000000..ba95e4a --- /dev/null +++ b/result.lisp @@ -0,0 +1,42 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: result.lisp +;;;; Purpose: Result functions for XLUnit +;;;; Authors: Kevin Rosenberg +;;;; +;;;; $Id: result.lisp,v 1.1 2003/08/04 12:01:54 kevin Exp $ +;;;; ************************************************************************* + +(in-package #:xlunit) + + +(defclass test-result () + ((test :initarg :test :reader result-test) + (count :initform 0 :accessor test-count) + (failures :initarg :failures :reader test-failures :initform nil) + (errors :initarg :errors :reader test-errors :initform nil)) + (:documentation "The result of applying a test")) + + +(defun make-test-result () + (make-instance 'test-result)) + +(defclass test-failure () + ((failed-test :initarg :failed-test :reader failed-test) + (thrown-condition :initarg :thrown-condition :reader thrown-condition))) + +(defmethod is-failure ((failure test-failure)) + (typep (thrown-condition failure) 'test-failure-condition)) + +(defmethod print-object ((obj test-failure) stream) + (print-unreadable-object (obj stream :type t :identity nil) + (format stream "~A: " (failed-test obj)) + (apply #'format stream + (simple-condition-format-control (thrown-condition obj)) + (simple-condition-format-arguments (thrown-condition obj))))) + +(defmethod was-successful ((result test-result)) + (and (null (test-failures result)) + (null (test-errors result))))