If this is a problem only in your test code, you could write a function to 
reset/re-initialize the global state, and call that function at the 
beginning of each test.

If you want to have a "global state" for each of the file that requires 
your module, global variables might not be the right approach...

Alex.

On Wednesday, August 8, 2018 at 1:29:38 AM UTC+8, lysseus wrote:
>
> I’ve got a library that takes  maintains global variables. I’d like to be 
> able to test different test files that require this library, but of course 
> if I require those files into a single test file for testing various 
> combinations of data it corrupts the global variables, which are only valid 
> for a single instance of test file. 
>
> Conceptually it looks like: 
>
> Library-File 
>         global a 
>         library-functions 
> Test-file-1 
>         require Library-file 
>         test-data-file-1 
> Test-file-2 
>         require Library-file 
>         test-data-file-2 
> Master-test-file 
>         require Test-file-1 Test-file-2 ;; doesn’t work of course…. 
>
> Any suggestions are appreciated. 
>
> Kevin 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to