<div dir="ltr">Hello,<br><br>There is a problem. 'require' 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 "file.rkt") 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"><<a href="mailto:clements@brinckerhoff.org">clements@brinckerhoff.org</a>></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>
> Hello Horace,<br>
><br>
> I thank you for patiently explaining me how to run racket from command line.<br>
><br>
> Actually, this is not exactly what I am looking for.<br>
><br>
> What I want is a script file. Such that I can test the modules of the program from command prompt.<br>
><br>
> Something like<br>
><br>
> *******<br>
> #!/bin/bash<br>
> racket -f "file.rkt"<br>
><br>
> racket (twice 2)<br>
> *******<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 "file.rkt")<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 'tests.rkt', 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>