[racket] rackunit question

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Sun Dec 22 03:18:59 EST 2013

On Sat, 21 Dec 2013 23:18:02 -0800
Evan Donahue <emdonahu at gmail.com> wrote:

> check out the main submodule.
> 

Thanks a lot. That does it nicely. 


-- 
Manfred



> 
> On Sat, Dec 21, 2013 at 10:47 PM, Manfred Lotz
> <manfred.lotz at arcor.de>wrote:
> 
> > Hi there,
> > In a small program I like to have the test cases in the same file.
> > How can I prevent the 'main' function of my program to be run when
> > I do a raco test?
> >
> >
> > Here is a minimal example:
> >
> > #lang racket
> >
> >
> > (define (myfun)
> >   (displayln "hey"))
> >
> > (myfun)
> >
> >
> > (module+ test
> >
> >   (require rackunit)
> >
> >   (check-equal? 1 1)
> >
> >   "all tests run")
> >
> >
> > How can I prevent myfun from being run when I issue
> >    raco test mytest.rkt
> > ?
> >
> >
> > Is there a condition I could ask for? Something like this:
> >   (when (not-raco-testing?)
> >      (myfun))
> >
> >
> >
> > --
> > Manfred
> >
> >
> >
> >
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> >
> 



Posted on the users mailing list.