[racket] testing impure stuff

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Dec 22 14:49:58 EST 2013

Manfred Lotz wrote at 12/22/2013 01:54 PM:
> Or perhaps even better create my directory structure on the fly and
> build my test cases upon this?
>
>    

Yes, like that.  It can be tedious to develop, but then your test suite 
is more likely to work when you or someone else needs it to.

I suggest building it under "(find-system-path 'temp-dir)".

I would probably make the parent directory for all tests for a run be 
named something like 
"<TEMP-DIR>/<MODULE-OR-PACKAGE-NAME>-testing/<UNUSED-SERIAL-OR-RANDOM-NUMBER>/".  
Keep in mind that multiple instances of the test suite could be running 
concurrently, so that's the main reason for the the unique number at the 
end.  You find the number by trying to create a new directory in a loop, 
with different numbers until one that can be created without already 
existing (or until you exhaust a set number of attempts or time that you 
have decided means you should  throw an error instead).

You should also make each run of the test suite remove its numbered test 
directory after it is done, even if there is an error.

Neil


Posted on the users mailing list.