[plt-scheme] Setup and teardown in SchemeUnit

From: Noel Welsh (noelwelsh at gmail.com)
Date: Sun Nov 30 17:57:23 EST 2008

I'm heading to sleep, so quickly:


(check-equal? (before (display "before\n") 0) 0)

Or make the abstraction:

(define (printing-check-equal? v1 v2)
  (before (display "before\n")
              (check-equal? v1 v2)))

I'm a bit surprised you want before/after when using checks.  I
thought they'd only be useful when using test-begin/test-case.


On Sun, Nov 30, 2008 at 10:47 PM, Michał Kwiatkowski
<constant.beta at gmail.com> wrote:
> 2008/11/30 Noel Welsh <noelwelsh at gmail.com>:
>> The before, after, and around macros are the SchemeUnit equivalent.
> Let me show you a sample code:
> #lang scheme
> (require (planet schematics/schemeunit:3))
> (before
>  (begin (display "Before") (newline))
>  (check-equal? 0 0)
>  (check-equal? 1 1)
>  (check-equal? 2 2))
> This displays "Before" only once. Is there a way to tell SchemeUnit to
> invoke setup procedure once for each test (so there would be three
> "Before"s in an example above)?
> Cheers,
> mk

Posted on the users mailing list.