Upgrade to PathTools 3.25
[p5sagit/p5-mst-13.2.git] / lib / File / Path.t
index 055fc46..d68351b 100755 (executable)
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Test::More tests => 72;
+use Test::More tests => 71;
 
 BEGIN {
     use_ok('File::Path');
@@ -74,17 +74,15 @@ SKIP: {
 
 my $count = rmtree({error => \$error});
 is( $count, 0, 'rmtree of nothing, count of zero' );
-is( scalar(@$error), 1, 'one diagnostic captureed' );
-eval { ($file, $message) = each %{$error->[0]} }; # too early to die, just in case
-is( $@, '', 'decoded diagnostic' );
-is( $file, '', 'general diagnostic' );
-is( $message, 'No root path(s) specified', 'expected diagnostic received' );
+is( scalar(@$error), 0, 'no diagnostic captured' );
 
 @created = mkpath($tmp_base, 0);
 is(scalar(@created), 0, "skipped making existing directories (old style 1)")
     or diag("unexpectedly recreated @created");
 
 $dir = catdir($tmp_base,'C');
+# mkpath returns unix syntax filespecs on VMS
+$dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS';
 @created = mkpath($tmp_base, $dir);
 is(scalar(@created), 1, "created directory (new style 1)");
 is($created[0], $dir, "created directory (new style 1) cross-check");
@@ -94,6 +92,8 @@ is(scalar(@created), 0, "skipped making existing directories (old style 2)")
     or diag("unexpectedly recreated @created");
 
 $dir2 = catdir($tmp_base,'D');
+# mkpath returns unix syntax filespecs on VMS
+$dir2 = VMS::Filespec::unixify($dir2) if $^O eq 'VMS';
 @created = mkpath($tmp_base, $dir, $dir2);
 is(scalar(@created), 1, "created directory (new style 2)");
 is($created[0], $dir2, "created directory (new style 2) cross-check");
@@ -220,10 +220,21 @@ SKIP: {
     is( $file, $dir, 'symlink reported in error' );
 }
 
+{
+    $dir = catdir($tmp_base, 'ZZ');
+    @created = mkpath($dir);
+    is(scalar(@created), 1, "create a ZZ directory");
+
+    local @ARGV = ($dir);
+    rmtree( [grep -e $_, @ARGV], 0, 0 );
+    ok(!-e $dir, "blow it away via \@ARGV");
+}
+
 SKIP: {
     skip 'Test::Output not available', 10
         unless $has_Test_Output;
 
+
     SKIP: {
         $dir = catdir('EXTRA', '3');
         skip "extra scenarios not set up, see eg/setup-extra-tests", 2
@@ -252,7 +263,7 @@ and can't restore permissions to \d+
     $dir2 = catdir($base,'B');
 
     stderr_like(
-        sub { rmtree( [], 1 ) },
+        sub { rmtree( undef, 1 ) },
         qr/\ANo root path\(s\) specified\b/,
         "rmtree of nothing carps sensibly"
     );