[racket] Help: Running racket programs from command line

From: John Clements (clements at brinckerhoff.org)
Date: Tue Sep 28 00:32:12 EDT 2010

On Sep 27, 2010, at 3:35 PM, A Z wrote:

> Hello Horace,
> 
> I thank you for patiently explaining me how to run racket from command line.
> 
> Actually, this is not exactly what I am looking for.
> 
> What I want is a script file. Such that I can test the modules of the program from command prompt. 
> 
> Something like 
> 
> *******
> #!/bin/bash
> racket -f "file.rkt"
> 
> racket (twice 2)
> *******

Ah! Caught.

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:

****
#lang racket

(require "file.rkt")
(require rackunit)

(check-equal? (twice 2) 4)
*****


Then just run this file from the command-line.  If it were called 'tests.rkt', you could run it as

racket tests.rkt



John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20100927/487b3785/attachment.p7s>

Posted on the users mailing list.