<div dir="ltr">Hello,<br><br>There is a problem. &#39;require&#39; does not go inside the definition of a function. DrRacket complains that it needs to go in a module.<br><br>I need (require path) inside a function because I want to run functions from each .rkt file in a directory. I can write (require &quot;file.rkt&quot;) for each of the file at the top, but that does not look good.<br>
<br>Thanks everyone.<br>Shad Kirmani<br><br><br><div class="gmail_quote">On Tue, Sep 28, 2010 at 12:32 AM, John Clements <span dir="ltr">&lt;<a href="mailto:clements@brinckerhoff.org">clements@brinckerhoff.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><br>
On Sep 27, 2010, at 3:35 PM, A Z wrote:<br>
<br>
&gt; Hello Horace,<br>
&gt;<br>
&gt; I thank you for patiently explaining me how to run racket from command line.<br>
&gt;<br>
&gt; Actually, this is not exactly what I am looking for.<br>
&gt;<br>
&gt; What I want is a script file. Such that I can test the modules of the program from command prompt.<br>
&gt;<br>
&gt; Something like<br>
&gt;<br>
&gt; *******<br>
&gt; #!/bin/bash<br>
&gt; racket -f &quot;file.rkt&quot;<br>
&gt;<br>
&gt; racket (twice 2)<br>
&gt; *******<br>
<br>
</div>Ah! Caught.<br>
<br>
Okay, you want a file that tests another file.  The easy way to do this is not to dip into shell programming at all, but to write your script as another racket program.  For the example you provide:<br>
<br>
****<br>
#lang racket<br>
<br>
(require &quot;file.rkt&quot;)<br>
(require rackunit)<br>
<br>
(check-equal? (twice 2) 4)<br>
*****<br>
<br>
<br>
Then just run this file from the command-line.  If it were called &#39;tests.rkt&#39;, you could run it as<br>
<br>
racket tests.rkt<br>
<font color="#888888"><br>
<br>
<br>
John Clements<br>
<br>
</font></blockquote></div><br></div>