This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
File::Path: synch with CPAN version 2.18
[perl5.git] / cpan / File-Path / t / Path.t
index 7eb8572..b265aee 100644 (file)
@@ -816,7 +816,7 @@ is(
 }
 
 SKIP: {
-    my $skip_count = 5;
+    my $skip_count = 3;
     skip "Windows will not set this error condition", $skip_count
         if $^O eq 'MSWin32';
 
@@ -826,10 +826,10 @@ SKIP: {
     my (@created, $error);
     my $user = join('_' => 'foobar', $$);
     @created = mkpath($deepest, { mode => 0711, user => $user, error => \$error });
-    TODO: {
-        local $TODO = "Notwithstanding the phony 'user', mkpath will actually create subdirectories; should it?";
-        is(scalar(@created), 0, "No subdirectories created");
-    }
+#    TODO: {
+#        local $TODO = "Notwithstanding the phony 'user', mkpath will actually create subdirectories; should it?";
+#        is(scalar(@created), 0, "No subdirectories created");
+#    }
     is(scalar(@$error), 1, "caught error condition" );
     my ($file, $message) = each %{$error->[0]};
     like($message,
@@ -845,7 +845,18 @@ SKIP: {
     my ($least_deep, $next_deepest, $deepest) =
         create_3_level_subdirs( qw| b5wj8CJcc7gl XTJe2C3WGLg5 VZ_y2T0XfKu3 | );
     my (@created, $error);
+    my $warn;
+    local $SIG{__WARN__} = sub { $warn = shift };
     @created = mkpath($deepest, { mode => 0711, uid => $>, error => \$error });
+    SKIP: {
+        my $skip_count = 1;
+        skip "Warning should only appear on Windows", $skip_count
+            unless $^O eq 'MSWin32';
+        like($warn,
+            qr/Option\(s\) implausible on Win32 passed to mkpath\(\) or make_path\(\)/,
+            'make_path with final hashref warned due to options implausible on Win32'
+        );
+    }
     is(scalar(@created), 3, "Provide valid 'uid' argument: 3 subdirectories created");
 
     cleanup_3_level_subdirs($least_deep);
@@ -878,10 +889,10 @@ SKIP: {
     my (@created, $error);
     my $bad_group = join('_' => 'foobarbaz', $$);
     @created = mkpath($deepest, { mode => 0711, group => $bad_group, error => \$error });
-    TODO: {
-        local $TODO = "Notwithstanding the phony 'group', mkpath will actually create subdirectories; should it?";
-        is(scalar(@created), 0, "No subdirectories created");
-    }
+#    TODO: {
+#        local $TODO = "Notwithstanding the phony 'group', mkpath will actually create subdirectories; should it?";
+#        is(scalar(@created), 0, "No subdirectories created");
+#    }
     is(scalar(@$error), 1, "caught error condition" );
     my ($file, $message) = each %{$error->[0]};
     like($message,
@@ -897,7 +908,18 @@ SKIP: {
     my ($least_deep, $next_deepest, $deepest) =
         create_3_level_subdirs( qw| BEcigvaBNisY rd4lJ1iZRyeS OyQnDPIBxP2K | );
     my (@created, $error);
+    my $warn;
+    local $SIG{__WARN__} = sub { $warn = shift };
     @created = mkpath($deepest, { mode => 0711, group => $(, error => \$error });
+    SKIP: {
+        my $skip_count = 1;
+        skip "Warning should only appear on Windows", $skip_count
+            unless $^O eq 'MSWin32';
+        like($warn,
+            qr/Option\(s\) implausible on Win32 passed to mkpath\(\) or make_path\(\)/,
+            'make_path with final hashref warned due to options implausible on Win32'
+        );
+    }
     is(scalar(@created), 3, "Provide valid 'group' argument: 3 subdirectories created");
 
     cleanup_3_level_subdirs($least_deep);