Skip to content

Commit

Permalink
#9: Fix for the 01_selftest.t failure
Browse files Browse the repository at this point in the history
  • Loading branch information
reneeb committed Dec 11, 2018
1 parent 9b67be8 commit 8795804
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
8 changes: 6 additions & 2 deletions lib/Test/CheckManifest.pm
Expand Up @@ -247,14 +247,18 @@ sub _is_excluded{
}

my @matches = grep{ $file =~ /$_$/ }@excluded_files;

return 1 if @matches;

my $dirname = dirname $file;

if($bool eq 'or'){
push @matches, $file if grep{ref($_) and ref($_) eq 'Regexp' and $file =~ /$_/}@$filter;
push @matches, $file if grep{$file =~ /^\Q$_\E/}@$dirref;
push @matches, $file if grep{ $dirname eq $_ }@$dirref;
}
else{
if(grep{$file =~ /$_/ and ref($_) and ref($_) eq 'Regexp'}@$filter and
grep{$file =~ /^\Q$_\E/ and not ref($_)}@$dirref){
grep{ $dirname eq $_ and not ref($_)}@$dirref){
push @matches, $file;
}
}
Expand Down
2 changes: 1 addition & 1 deletion t/00_load.t
Expand Up @@ -4,4 +4,4 @@ use strict;
use warnings;
use Test::More tests => 1;

use_ok('Test::CheckManifest');
use_ok('Test::CheckManifest');
18 changes: 14 additions & 4 deletions t/01_selftest.t
Expand Up @@ -6,7 +6,7 @@ use File::Spec;
use File::Basename;
use Test::More;

eval "use Test::CheckManifest tests => 9";
eval "use Test::CheckManifest tests => 10";
plan skip_all => "Test::CheckManifest required" if $@;

#$Test::CheckManifest::VERBOSE = 0;
Expand Down Expand Up @@ -49,14 +49,24 @@ Test::CheckManifest::_not_ok_manifest({filter => [qr/\.git/], exclude => ['/.git
Test::CheckManifest::_not_ok_manifest({filter => [qr/\.git/],
bool => 'and',
exclude => ['/t/test']}, 'filter AND exclude');
ok_manifest({filter => [qr/\.(git|build)/],
exclude => ['/t/test']}, 'filter OR exclude');

Test::CheckManifest::_not_ok_manifest({
filter => [qr/\.(git|build)/],
exclude => ['/t/test'],
}, 'filter OR exclude - test.svn is missing');

unlink $file2;

ok_manifest({
filter => [qr/\.(git|build)/],
exclude => ['/t/test'],
}, 'filter OR exclude');

unlink $file3;

ok_manifest({filter => [qr/\.git/, qr/\.svn/, qr/\.build/ ]},'Filter \.git or \.svn');

unlink $file2, $file1;
unlink $file1;
rmdir $dir;
rmdir $dir2;

Expand Down
1 change: 1 addition & 0 deletions t/xt/02_issue1.t
Expand Up @@ -11,3 +11,4 @@ use Cwd;
ok_manifest({ filter => [ qr/\.(git|build)/, qr/Test-CheckManifest-/ ], dir => $dir });

}

1 change: 1 addition & 0 deletions t/xt/03_issue7.t
Expand Up @@ -32,3 +32,4 @@ SKIP: {
}

}

0 comments on commit 8795804

Please sign in to comment.