This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Ensure t/op/mkdir.t passes under minitest by loading File::Path in an eval.
authorNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 17:58:26 +0000 (17:58 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 20:39:57 +0000 (20:39 +0000)
File::Path::rmtree() is only used as a cleanup function of last resort - by
default t/op/mkdir.t directly cleans up the test directory that it creates
before it exits.

t/op/mkdir.t

index 0ad5dac..ebbbd2e 100644 (file)
@@ -8,8 +8,15 @@ BEGIN {
 
 plan tests => 22;
 
-use File::Path;
-rmtree('blurfl');
+unless (eval {
+    require File::Path;
+    File::Path::rmtree('blurfl');
+    1
+}) {
+    diag("$0 may fail if its temporary directory remains from a previous run");
+    diag("Attempted to load File::Path to delete directory t/blurfl - error was\n$@");
+    diag("\nIf you have problems, please manually delete t/blurfl");
+}    
 
 # tests 3 and 7 rather naughtily expect English error messages
 $ENV{'LC_ALL'} = 'C';