anchor.diff:      (when (or *print-summary* *print-failures* *print-errors*)
         (print-summary result))))
   
  -(defun summarize-results (results)
  -  "Print a summary of all results."
  +(defun summarize-results (results &optional
  +                          (stream *standard-output*))
  +  "Print a summary of all results to the stream."
     (let ((pass (pass results))
           (fail (fail results)))
  -    (format t "~&Unit Test Summary~%")
  -    (format t " | ~D assertions total~%" (+ pass fail))
  -    (format t " | ~D passed~%" pass)
  -    (format t " | ~D failed~%" fail)
  -    (format t " | ~D execution errors~%" (exerr results))
  -    (format t " | ~D missing tests~2%"
  +    (format stream "~&Unit Test Summary~%")
  +    (format stream " | ~D assertions total~%" (+ pass fail))
  +    (format stream " | ~D passed~%" pass)
  +    (format stream " | ~D failed~%" fail)
  +    (format stream " | ~D execution errors~%" (exerr results))
  +    (format stream " | ~D missing tests~2%"
               (length (missing-tests results)))))
   
   ;;; Run the tests
  +
  +(define-condition test-run-complete ()
  +  ((results
  +    :type 'test-results-db
  +    :initarg :results
  +    :reader results))
  +  (:documentation
  +   "Signaled when a test run is finished."))
   
   (defun %run-all-thunks (&optional (package *package*))
     "Run all of the test thunks in the package."
  
positive.code: 
  ;;; Print failures
  
  (defgeneric print-failures (result)
    (:documentation
     "Report the results of the failed assertion."))
  
  (defmethod print-failures :around ((result failure-result))
    "Failure header and footer output."
    (format t "~& | Failed Form: ~S" (form result))
    (call-next-method)
    (when (extras result)
      (format t "~{~& | ~S => ~S~}~%" (extras result)))
    (format t "~& |~%")
    (class-name (class-of result)))
  
  (defmethod print-failures ((result failure-result))
    (format t "~& | Expected ~{~S~^; ~} " (expected result))
    (format t "~<~% | ~:;but saw ~{~S~^; ~}~>" (actual result)))
  
  (defmethod print-failures ((result error-result))
    (format t "~& | ~@[Should have signalled ~{~S~^; ~} but saw~]"
            (expected result))
    (format t " ~{~S~^; ~}" (actual result)))
  
  (defmethod print-failures ((result macro-result))
    (format t "~& | Should have expanded to ~{~S~^; ~} "
            (expected result))
    (format t "~<~%~:;but saw ~{~S~^; ~}~>" (actual result)))
  
  (defmethod print-failures ((result output-result))
    (format t "~& | Should have printed ~{~S~^; ~} "
            (expected result))
    (format t "~<~%~:;but saw ~{~S~^; ~}~>"
            (actual result)))
  
  (defmethod print-failures ((result test-result))
    "Print the failed assertions in the unit test."
    (loop for fail in (fail result) do
          (print-failures fail)))
  
  (defmethod print-failures ((results test-results-db))
    "Print all of the failure tests."
    (loop with db = (database results)
          for test in (failed-tests results)
          as result = (gethash test db)
          do
          (print-failures result)
          (print-summary result)))
  
  ;;; Print errors
  
  (defgeneric print-errors (result)
    (:documentation
     "Print the error condition."))
  
  (defmethod print-errors ((result test-result))
    "Print the error condition."
    (let ((exerr (exerr result))
          (*print-escape* nil))
      (when exerr
        (format t "~& | Execution error:~% | ~W" exerr)
        (format t "~& |~%"))))
  
  (defmethod print-errors ((results test-results-db))
    "Print all of the error tests."
    (loop with db = (database results)
          for test in (error-tests results)
          as result = (gethash test db)
          do
          (print-errors result)
          (print-summary result)))
  
  ;;; Useful equality predicates for tests
  
  
negative.code:   (:documentation
     "Store the results of the unit test."))
  
  (defun print-summary (test-result &optional
                        (stream *standard-output*))
    "Print a summary of the test result."
    (format stream "~&~A: ~S assertions passed, ~S failed"
            (name test-result)
            (pass test-result)
            (length (fail test-result)))
    (if (exerr test-result)
        (format stream ", and an execution error.")
        (write-char #\. stream))
    (terpri stream)
    (terpri stream))
  
  (defun run-code (code)
    "Run the code to test the assertions."
  