From: Owen Rodley Date: Wed, 1 May 2013 02:39:16 +0000 (+1200) Subject: Variable to enable/disable color in test output X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=c8754d3b98508cf5e125bd07b819dcfc0c447c2a;p=jscl.git Variable to enable/disable color in test output --- diff --git a/tests.lisp b/tests.lisp index 6fce25e..8c57af4 100644 --- a/tests.lisp +++ b/tests.lisp @@ -5,6 +5,9 @@ (defvar *expected-failures* 0) (defvar *unexpected-passes* 0) +(defvar *use-html-output-p* t) +(defun if-html (string) (if *use-html-output-p* string "")) + (defvar *timestamp* nil) (defmacro test (condition) @@ -14,9 +17,11 @@ (write-line ,(concat "Test `" (prin1-to-string condition) "' passed")) (incf *passed-tests*)) (t - (write-line ,(concat "Test `" - (prin1-to-string condition) - "' failed.")) + (write-line (concat (if-html "") + "Test `" + ,(prin1-to-string condition) + "' failed." + (if-html ""))) (incf *failed-tests*))) (incf *total-tests*))) @@ -24,9 +29,11 @@ `(progn (cond (,condition - (write-line ,(concat "Test `" - (prin1-to-string condition) - "' passed unexpectedly!")) + (write-line (concat (if-html "") + "Test `" + ,(prin1-to-string condition) + "' passed unexpectedly!" + (if-html ""))) (incf *unexpected-passes*)) (t (write-line ,(concat "Test `" (prin1-to-string condition) "' failed expectedly."))