From: shasckaw Date: 2004-03-15T21:44:36+09:00 Subject: Re: [help] unit testing when dealing with files Phlip wrote: > Shashank Date wrote: > >>shasckaw wrote: > > >>>Should I use ruby mock? How? Or something else? And then what? >> >>I will recommend FlexMock for this purpose. You can find FlexMock at: >>http://onestepback.org/software/flexmock/ > > > To mock what? Just write a file and run a checksum on it, right? > > Use a Mock to test. > > * what time is it > * releasing resources > * pseudo-random numbers > * without really weird side-effects > * expensive or slow hardware > * modules that depend on modules that don't exist yet, which you can't > start > * 3rd party modules that can't Get everything they Set > * responses to failing system calls. > > Writing and reading a modern file won't get farther than the memory buffers, > so "slow hardware" doesn't apply. > Well, I know the basis of unit testing but not of mocking. Thanks for the indications. Well, that's true that I don't need anything more than just random files with random content that will be randomly modified or not, and tests will be done on the functions that process them in various ways (checksum for example). But the fact is I have no idea where to begin such a thing, I mean the creation of random files with random content... and if I could randomly generate a random directory tree with all those random files, it would be even better. Can someone help me, please? Thanks, Lio