[racket] Unit Testing Best Practice in Racket

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri May 4 16:57:36 EDT 2012

On Apr 30, 2012, at 7:05 PM, Eli Barzilay wrote:

> 
> 3. If you use nightly builds, you can put the test code in a
>   sub-module:
> 
>     #lang racket
>     ...
>     (module+ test (require rackunit))
>     ...
>     (module+ test ...test code here...)
>     ...
> 
>   The `test' submodule (which is made from all of the (module+ test
>   ...) parts) is included in the bytecode, but it is not loaded or
>   executed when the module is required.  If you run the code directly
>   in drracket it would run it, or if you use the `raco test' utility.
> 
>   (Again, this is all new stuff that is not in 5.2.1.)


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



Posted on the users mailing list.