(defpackage :cl-who-test
  (:use :cl :cl-who))

(in-package :cl-who-test)

(defun test-form (form str)
  "Tests that evaluation of FORM produces STR."
  (assert (equalp (eval form) str)))

(defun test-all ()
  "Performs all tests from cl-who-tests.txt.
Each test should a be a with-html-output-to-string form followed by a
string which it should be evaluated to."
  (with-open-file (in "cl-who-tests.txt" :direction :input)
    (loop
       for form1 = (read in nil 'eof)
       and form2 = (read in nil 'eof)
       while (not (eq form1 'eof))
       do (test-form form1 form2))))