<div dir="ltr">check out the main submodule.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 21, 2013 at 10:47 PM, Manfred Lotz <span dir="ltr"><<a href="mailto:manfred.lotz@arcor.de" target="_blank">manfred.lotz@arcor.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br>
In a small program I like to have the test cases in the same file. How<br>
can I prevent the 'main' function of my program to be run when I do a<br>
raco test?<br>
<br>
<br>
Here is a minimal example:<br>
<br>
#lang racket<br>
<br>
<br>
(define (myfun)<br>
  (displayln "hey"))<br>
<br>
(myfun)<br>
<br>
<br>
(module+ test<br>
<br>
  (require rackunit)<br>
<br>
  (check-equal? 1 1)<br>
<br>
  "all tests run")<br>
<br>
<br>
How can I prevent myfun from being run when I issue<br>
   raco test mytest.rkt<br>
?<br>
<br>
<br>
Is there a condition I could ask for? Something like this:<br>
  (when (not-raco-testing?)<br>
     (myfun))<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Manfred<br>
<br>
<br>
<br>
<br>
____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</font></span></blockquote></div><br></div>