Add test for previously uncovered case.
authorJames E Keenan <jkeenan@cpan.org>
Wed, 4 Dec 2013 02:56:13 +0000 (03:56 +0100)
committerJames E Keenan <jkeenan@cpan.org>
Wed, 4 Dec 2013 02:56:13 +0000 (03:56 +0100)
Explicitly assigned $File::Find::untaint_pattern.

ext/File-Find/t/taint.t

index 1675e6c..a32d10f 100644 (file)
@@ -4,7 +4,7 @@ use Test::More;
 BEGIN {
     plan(
         ${^TAINT}
-        ? (tests => 45)
+        ? (tests => 54)
         : (skip_all => "A perl without taint support") 
     );
 }
@@ -203,6 +203,30 @@ File::Find::find( {wanted => \&wanted_File_Dir_prune, untaint => 1,
 
 is(scalar keys %Expect_File, 0, 'Found all expected files');
 
+{
+    %Expect_File = (File::Spec->curdir => 1, file_path('fsl') =>
+                    1,file_path('fa_ord') => 1, file_path('fab') => 1,
+                    file_path('fab_ord') => 1, file_path('faba') => 1,
+                    file_path('faa') => 1, file_path('faa_ord') => 1);
+    delete $Expect_File{ file_path('fsl') } unless $symlink_exists;
+    %Expect_Name = ();
+
+    %Expect_Dir = ( dir_path('fa') => 1, dir_path('faa') => 1,
+                    dir_path('fab') => 1, dir_path('faba') => 1,
+                    dir_path('fb') => 1, dir_path('fba') => 1);
+
+    delete @Expect_Dir{ dir_path('fb'), dir_path('fba') } unless $symlink_exists;
+    local $File::Find::untaint_pattern = qr|^([@\w./\-+]+)$|;
+    File::Find::find(
+        {
+            wanted => \&wanted_File_Dir_prune,
+            untaint => 1,
+        },
+        topdir('fa')
+    );
+    is(scalar keys %Expect_File, 0,
+        'Explicitly defined $File::Find::untaint_pattern: Found all expected files');
+}
 
 # don't untaint at all, should die
 %Expect_File = ();