The stupid question is the question not asked | |
PerlMonks |
Unit test - check file created using test::directoryby APGRMF (Novice) |
on Jul 03, 2014 at 16:49 UTC ( [id://1092197]=perlquestion: print w/replies, xml ) | Need Help?? |
APGRMF has asked for the wisdom of the Perl Monks concerning the following question: Hi I'm new to Perl and looking at it in terms of test-driven development and unit testing. I would like to write a test that that will confirm that a function has created a file on the file system. I think I would like my unit test to: - check the file doesn't exist - call the function (passing in a path and file name as arguments) - check the file now exists - clean up after itself and delete any files or directories it created during the test My attempts at this are failing. I'm using Test::Directory. Whilst I can confirm that the specified file gets created, I cannot cleanup up after the test. I've almost resorted to using rmtree but this too fails as permision is denied. I'm using ActivePerl 5.16.3 I'm clearly missing something or approaching it the wrong way. Any thoughts would be greatly appreciated. My test is of the form:
Back to
Seekers of Perl Wisdom
|
|