<div dir="ltr">You should also consider structuring your code such that the code that actually touches the filesystem is separate from the logic that does whatever your program does. Then you can plug in a "fake" filesystem that just implements the same api as the real code, but that also does some specific, small thing for the purpose of testing.<div>
<br></div><div>Robby</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 22, 2013 at 1:28 PM, Manfred Lotz <span dir="ltr"><<a href="mailto:manfred.lotz@arcor.de" target="_blank">manfred.lotz@arcor.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sun, 22 Dec 2013 14:04:40 -0500<br>
Matthias Felleisen <<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>><br>
wrote:<br>
<div><div class="h5"><br>
><br>
> On Dec 22, 2013, at 1:54 PM, Manfred Lotz wrote:<br>
><br>
> > Hi there,<br>
> > I just wrote a file duplicate finder where I'm not quite sure how to<br>
> > build up my test cases.<br>
> ><br>
> > The problem is that most of my test cases are impure. They rely<br>
> > upon a directory layout.<br>
> ><br>
> > What is the best way to do this? Should I create a directory<br>
> > structure containing most (or better all) of my test cases, and<br>
> > then base my test cases upon the existing structure?<br>
> ><br>
> > Or perhaps even better create my directory structure on the fly and<br>
> > build my test cases upon this?<br>
> ><br>
> ><br>
> > How do other people create test cases for impure situations?<br>
><br>
><br>
> I have written such a program several years ago (a primitive version)<br>
> and I tested it by writing another program that generated tmp<br>
> directories with certain characteristics. -- Matthias<br>
><br>
<br>
<br>
</div></div>Ok, this convinces me to create a directory tree structure on the fly<br>
(containing all cases I need), and then base my test cases on the<br>
created tree structure.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Thanks,<br>
Manfred<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div>