Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Unit test - check file created using test::directory

by Bloodnok (Vicar)
on Jul 03, 2014 at 17:23 UTC ( #1092198=note: print w/replies, xml ) Need Help??


in reply to Unit test - check file created using test::directory

If I may make so bold, it would help (me at least) if you provided the error(s) that you're seeing.

A user level that continues to overstate my experience :-))
  • Comment on Re: Unit test - check file created using test::directory

Replies are listed 'Best First'.
Re^2: Unit test - check file created using test::directory
by APGRMF (Novice) on Jul 04, 2014 at 07:28 UTC

    Sorry. Should have been clearer. The following lines do not actually throw an error as far as I can see. They just don't do what I was hoping/expecting they would do - ie clean up the files and directories after the test.

    #cleanup after the test - this fails so far $dir->remove_files($log_file); $dir->remove_directories($log_dir); $dir->clean($log_dir);

    The commented rmtree command (when commented in and in scope) returns "cannot unlink file for unit-test-temp\xyz.log".

      Aha, looking at Test::Direcory, I would infer that the remove_files() and remove_directories() methods are used to remove files &/or directories from within the directory created by the constructor i.e. personally, I would expect the call $dir->remove_directories($log_dir); to fail because $log_dir is not a subdirectory of itself, the clean() method takes no args and is/should be used to rmdir the directory created by the constructor i.e. $log_dir.

      HTH ,

      A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1092198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2020-05-26 17:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?