File tree Expand file tree Collapse file tree 2 files changed +33
-15
lines changed Expand file tree Collapse file tree 2 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -615,16 +615,21 @@ sub is_pod_file {
615
615
shift -> name =~ / \. pod$ /i ;
616
616
}
617
617
618
- =head2 is_in_test_directory
618
+ =head2 is_in_excluded_directory
619
619
620
- Returns true if the file is below a t directory.
620
+ Returns true if the file is below an excluded directory.
621
621
622
622
=cut
623
623
624
- sub is_in_test_directory {
625
- my $self = shift ;
626
- my @parts = split m { /} , $self -> path;
627
- return any { $_ eq ' t' } @parts ;
624
+ sub is_in_excluded_directory {
625
+ my $self = shift ;
626
+ my @excluded = qw[ t inc local] ;
627
+ my @parts = split m { /} , $self -> path;
628
+ return any {
629
+ my $part = $_ ;
630
+ any { $_ eq $part } @excluded ;
631
+ }
632
+ @parts ;
628
633
}
629
634
630
635
=head2 add_module
@@ -664,7 +669,7 @@ does not include any modules, the L</indexed> property is true.
664
669
sub set_indexed {
665
670
my ( $self , $meta ) = @_ ;
666
671
667
- if ( $self -> is_in_test_directory () ) {
672
+ if ( $self -> is_in_excluded_directory () ) {
668
673
foreach my $mod ( @{ $self -> module } ) {
669
674
$mod -> indexed(0);
670
675
}
Original file line number Diff line number Diff line change @@ -13,19 +13,32 @@ my %stub = (
13
13
);
14
14
15
15
{
16
- my @test_paths = qw( t/whomp foo/t/bar cuppa/t ) ;
17
- my @non_test_paths = qw( foo/bart/shorts tit/mouse say/wat ) ;
16
+ my @excluded_paths = qw(
17
+ t/whomp
18
+ foo/t/bar
19
+ cuppa/t
20
+ conv/inc/ing
21
+ buy/local/beer
22
+ ) ;
23
+
24
+ my @non_excluded_paths = qw(
25
+ foo/bart/shorts
26
+ tit/mouse
27
+ say/wat
28
+ wince/inducing/module
29
+ not/locally/made
30
+ ) ;
18
31
19
- foreach my $path (@test_paths ) {
32
+ foreach my $path (@excluded_paths ) {
20
33
my $file = MetaCPAN::Document::File-> new( %stub , path => $path );
21
- my $msg = " $path is in a test directory" ;
22
- ok( $file -> is_in_test_directory (), $msg );
34
+ my $msg = " $path is in an excluded directory" ;
35
+ ok( $file -> is_in_excluded_directory (), $msg );
23
36
}
24
37
25
- foreach my $path (@non_test_paths ) {
38
+ foreach my $path (@non_excluded_paths ) {
26
39
my $file = MetaCPAN::Document::File-> new( %stub , path => $path );
27
- my $msg = " $path is not in a test directory" ;
28
- ok( !$file -> is_in_test_directory (), $msg );
40
+ my $msg = " $path is not in an excluded directory" ;
41
+ ok( !$file -> is_in_excluded_directory (), $msg );
29
42
}
30
43
}
31
44
You can’t perform that action at this time.
0 commit comments