Error in test runner example David Banks (29 Mar 2011 06:49 UTC)
Re: Error in test runner example Per Bothner (30 Mar 2011 02:24 UTC)

Error in test runner example David Banks 29 Mar 2011 06:49 UTC

Hi,

There seems to be an error in the example of a custom test-runner.  It
tries to use a nonexistent test-runner-on-test! procedure (should
probably be test-runner-on-test-end!) with a slightly different
interface (maybe older version).  Working version is given below.

(define (my-simple-runner filename)
  (let ((runner (test-runner-null))
	(port (open-output-file filename))
        (num-passed 0)
        (num-failed 0))
    (test-runner-on-test-end! runner
      (lambda (runner)
        (case (test-result-kind runner)
          ((pass xpass) (set! num-passed (+ num-passed 1)))
          ((fail xfail) (set! num-failed (+ num-failed 1)))
          (else #t))))
    (test-runner-on-final! runner
       (lambda (runner)
          (format port "Passing tests: ~d.~%Failing tests: ~d.~%"
                  num-passed num-failed)
	  (close-output-port port)))
    runner))

(test-runner-factory
 (lambda () (my-simple-runner "/tmp/my-test.log")))

Cheers,
--
David Banks  <xxxxxx@gmail.com>