[plt-scheme] Interaction of schemeunit with modules

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Wed May 20 01:40:58 EDT 2009

On Wed, May 20, 2009 at 6:36 AM, Eli Barzilay <eli at barzilay.org> wrote:
> On May 20, Paulo J. Matos wrote:
>> Hi all,
>>
>> I am testing a couple of modules and some of them export a single
>> function, however, I want to create tests that test internal
>> functions individually but requiring the module in the test module
>> only imports the single procedure I export so I end up being hands
>> tied when it comes to testing the other functions. What's the
>> reasonable approach to circumvent this issue?  It would be probably
>> nice, I guess, to be able to say "hey, the tests module in X should
>> see it all in X!"
>
> One way to do this is with `module->namespace' to get the namespace of
> the module (I think that this is how `require/expose' works).  Another
> way which is very convenient for testing is to use the sandbox:
>

Hadn't noticed require/expose before. Great!

>  (require scheme/sandbox)
>  (define e (make-module-evaluator (string->path "some-file")))
>
> and at this point you have `e' bound to an evaluator that works inside
> of your module, similarly to the repl in drscheme.
>

I will look into this also. Thanks a lot! :)

> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                  http://www.barzilay.org/                 Maze is Life!
>



-- 
Paulo Jorge Matos - pocmatos at gmail.com
Webpage: http://www.personal.soton.ac.uk/pocm


Posted on the users mailing list.