File: textui.lisp

package info (click to toggle)
cl-xlunit 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 92 kB
  • ctags: 110
  • sloc: lisp: 573; makefile: 39
file content (40 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; ID:      $Id$
;;;; Purpose: Text UI for Test Runner
;;;;
;;;; *************************************************************************

(in-package #:xlunit)

;;; Test Runners

(defclass textui-test-runner (test-listener)
  ((ostream :initform nil :accessor ostream :initarg :ostream))
  (:default-initargs :ostream *standard-output*))

(defmethod add-error ((ob textui-test-runner) test-case condition)
  (declare (ignore test-case condition))
  (format (ostream ob) "E"))

(defmethod add-failure ((ob textui-test-runner) test-case condition)
  (declare (ignore test-case condition))
  (format (ostream ob) "F"))

(defmethod start-test ((ob textui-test-runner) test-case)
  (declare (ignore test-case))
  (format (ostream ob) "."))


(defmethod textui-test-run ((ob test))
  (let ((test-runner (make-instance 'textui-test-runner))
        (result (make-instance 'test-results))
        (start-time (get-internal-real-time)))
    (add-listener result test-runner)
    (run-on-test-results ob result)
    (print-results test-runner result
                   (/ (- (get-internal-real-time) start-time)
                      internal-time-units-per-second))
    result))