X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests.lisp;h=594c7cca4659a8d665c7c9984342c22e5295e1a7;hb=bf2a019d267d23ce1ed6b0eb09da07310bb7e758;hp=6fce25e807f9a4b880ae560c93f49be8eaa834a2;hpb=1cd3b2403660569e2983ce646fbf0d364fbfefe5;p=jscl.git
diff --git a/tests.lisp b/tests.lisp
index 6fce25e..594c7cc 100644
--- a/tests.lisp
+++ b/tests.lisp
@@ -1,22 +1,22 @@
-(defvar *total-tests* 0)
-(defvar *passed-tests* 0)
-(defvar *failed-tests* 0)
-
-(defvar *expected-failures* 0)
-(defvar *unexpected-passes* 0)
+(defparameter *total-tests* 0)
+(defparameter *passed-tests* 0)
+(defparameter *failed-tests* 0)
+(defparameter *expected-failures* 0)
+(defparameter *unexpected-passes* 0)
+(defvar *use-html-output-p* t)
(defvar *timestamp* nil)
(defmacro test (condition)
`(progn
(cond
(,condition
- (write-line ,(concat "Test `" (prin1-to-string condition) "' passed"))
+ (format t "Test `~S' passed~%" ',condition)
(incf *passed-tests*))
(t
- (write-line ,(concat "Test `"
- (prin1-to-string condition)
- "' failed."))
+ (if *use-html-output-p*
+ (format t "Test `~S' failed.~%" ',condition)
+ (format t "Test `~S' failed.~%" ',condition))
(incf *failed-tests*)))
(incf *total-tests*)))
@@ -24,16 +24,18 @@
`(progn
(cond
(,condition
- (write-line ,(concat "Test `"
- (prin1-to-string condition)
- "' passed unexpectedly!"))
+ (if *use-html-output-p*
+ (format t "Test `~S' passed unexpectedly!~%" ',condition)
+ (format t "Test `~S' passed unexpectedly!~%" ',condition))
(incf *unexpected-passes*))
(t
- (write-line ,(concat "Test `" (prin1-to-string condition) "' failed expectedly."))
+ (format t "Test `~S' failed expectedly.~%" ',condition)
(incf *expected-failures*)))
(incf *total-tests*)))
-(write-line "Running tests...")
-(write-line "")
+(defmacro test-equal (form value)
+ `(test (equal ,form, value)))
+
+(format t "Running tests...~%~%")
(setq *timestamp* (get-internal-real-time))