[racket] Unit Testing Best Practice in Racket

From: Eli Barzilay (eli at barzilay.org)
Date: Fri May 4 17:01:44 EDT 2012

Just now, Matthias Felleisen wrote:
> On Apr 30, 2012, at 7:05 PM, Eli Barzilay wrote:
> >     #lang racket
> >     ...
> >     (module+ test (require rackunit))
> >     ...
> >     (module+ test ...test code here...)
> >     ...
> I have added this sketch to the Style guide, replacing my own manual
> method with this new notion:
>  http://www.ccs.neu.edu/home/matthias/Style/style/Units_of_Code.html#(part._.Sections_and_.Sub-modules)
> Note that this won't work in 5.2.1 yet. -- Matthias

BTW, it might have made sense for a testing framework to add some
macro to do that -- but the forms are close enough so it's not needed,
which is why I like the `module+' thing so much...

(BTW², the only very minor problem is "module" -- imagine telling
students about this: they don't need to know what a "module" is.  But
that's not a big problem, since even without knowing about modules in
the racket sense, they can understand it in the "subsection" sense...)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.