[racket-dev] Testing mode

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 28 02:36:54 EDT 2011

6 hours ago, Eli Barzilay wrote:
> 15 minutes ago, Jay McCarthy wrote:
> > We've talked before about having a testing mode so that tests could
> > be written inline, but not run when the module is normally run. I've
> > attached a patch that adds a simple way of doing this.
> > 
> > racket/test gives you
> > - with-testing
> > - with-deploying
> Why add more bindings?  Why not just use definitions instead,
>   (define (test) (...run test code...))
> ?
> This way there is no need to add more hacks when you need different
> kinds of testing (`with-gui-tests') or completely different run modes
> (`when-this-is-the-main-file').

To clarify, I'm thinking of some new command-line flag, say

  racket -F foo.rkt blah

which will require the file, and then run the `blah' function from
inside its namespace.  This way you get any testing functions or
whatever else you need from it.

(A raco command can be used instead, but it looks to me more fitting
as a racket flag.)

> > I think this is nice and a bare minimum that solves the problem. Any
> > thoughts?
> (There was also an issue of how to avoid having test code in the
> compiled form.)

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

Posted on the dev mailing list.