Index: t/03_no_index.t
===================================================================
--- t/03_no_index.t (revision 7935)
+++ t/03_no_index.t (working copy)
@@ -6,7 +6,7 @@
$^W = 1;
}
-use Test::More tests => 20;
+use Test::More tests => 24;
use File::Spec::Functions ':ALL';
use File::Find::Rule ();
use File::Find::Rule::Perl ();
@@ -56,10 +56,57 @@
}
}
+###################################################################
+# Several variations of absolute path and relative path , both
+# in no_index and in search prefix.
+SCOPE: {
+ my @params = (
+ { # PASS
+ name => 'Relative Path',
+ path => 'lib/File/Find/Rule/Perl.pm',
+ dir => curdir(),
+ check => qr{Rule/Perl\.pm},
+ },
+ { # FAIL
+ name => 'Dot-prefix path',
+ path => './lib/File/Find/Rule/Perl.pm',
+ dir => curdir(),
+ check => qr{Rule/Perl\.pm},
+ },
+ { # FAIL
+ name => 'Absolute path',
+ path => rel2abs(curdir()) .'/lib/File/Find/Rule/Perl.pm',
+ dir => curdir(),
+ check => qr{Rule/Perl\.pm},
+ },
+ { # FAIL
+ name => 'Absolute path, Absolute Dir',
+ path => rel2abs(curdir()) .'/lib/File/Find/Rule/Perl.pm',
+ dir => rel2abs(curdir()),
+ check => qr{Rule/Perl\.pm},
+ },
+ );
+ foreach my $p (@params) {
+ my $rule = FFR->relative->no_index({ file => [ $p->{path} ] })->file;
+ my @files = sort grep { $_ !~ m/blib/ && $_ =~ $p->{check}} $rule->in( $p->{dir} );
+ if( @files ){
+ ok( 0, 'No_index + filename ' . $p->{name} );
+ for( @files ){
+ diag( "File Found: $_ \n , no_index file was <$p->{path}>");
+ }
+ } else {
+ ok( 1, 'No_index + filename ' . $p->{name} );
+ }
+ }
+}
+
+
+
+
#####################################################################
# Run a test in a relative subdirectory
# Test with and without ->relative, and with and without a relative ->in