X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests.lisp;h=594c7cca4659a8d665c7c9984342c22e5295e1a7;hb=bc239e6931441439be5afd9c6221a532340e5eb1;hp=65b4ae2021560e8162e53115e8f06b31344af2f3;hpb=7e8425562de2bcfd1b4c4d335ceeeaa460a4ebc3;p=jscl.git
diff --git a/tests.lisp b/tests.lisp
index 65b4ae2..594c7cc 100644
--- a/tests.lisp
+++ b/tests.lisp
@@ -5,22 +5,18 @@
(defparameter *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)
`(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 (if-html "")
- "Test `"
- ,(prin1-to-string condition)
- "' failed."
- (if-html "")))
+ (if *use-html-output-p*
+ (format t "Test `~S' failed.~%" ',condition)
+ (format t "Test `~S' failed.~%" ',condition))
(incf *failed-tests*)))
(incf *total-tests*)))
@@ -28,18 +24,18 @@
`(progn
(cond
(,condition
- (write-line (concat (if-html "")
- "Test `"
- ,(prin1-to-string condition)
- "' passed unexpectedly!"
- (if-html "")))
+ (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))