Files
septeql/run-tests.lisp
2007-08-11 19:42:56 +00:00

23 lines
674 B
Common Lisp

(in-package :septeql)
(defun do-tests (&optional verbose)
(with-open-file (stream *tests-file*)
(let ((failed nil))
(loop
(let* ((eof (gensym))
(*package* #.*package*)
(send (read stream nil eof))
(expect (read stream nil eof)))
(when (eql send eof) (return failed))
(let* ((actual (eval send))
(summary (list :sent send :expected expect :got actual)))
(cond ((equal actual expect)
(when verbose
(format *trace-output* "OK ~A~% => ~A~%"
send expect)))
(t
(when verbose
(format *trace-output* "NOT ~A~% => ~A~% got ~A~%"
send expect actual))
(push summary failed)))))))))