[plt-scheme] More SchemeUnit confusion

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Sun Jun 7 09:11:26 EDT 2009

What's the SchemeUnit equivalent of JUnit setUp and tearDown?

I'm trying to test display and write functions for structures where
I've set the #prop:custom-write properties. I thought:

(define OUTPUTS
  (test-suite
   "Outputs"
   #:before (lambda () (set! out (open-output-string)))
   (test-case
    "write R1"
    (write R1 out)
    (check-equal? (get-output-string out) "(make-Rule S (E))"))
   (test-case
    "write R2"
    (write R2 out)
    (check-equal? (get-output-string out) "(make-Rule E (E \"-\" T)"))))

would reset out to a fresh output-port before each test case, but it
looks like it just runs once at the beginning of the suite rather than
before each test-case.

What's the right way of doing this?

Todd


Posted on the users mailing list.