-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from guillaumeaubert/master
Account for modules in the no_index section of META.yml
- Loading branch information
Showing
5 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use Test::Kwalitee::Extra qw(); | ||
|
||
|
||
# List of tests to run. | ||
my $tests = | ||
[ | ||
{ | ||
name => '"file" section.', | ||
distdir => 't/08-_get_packages_not_indexed/', | ||
no_index => { | ||
'file' => | ||
[ | ||
'LocalTest.pm' | ||
] | ||
}, | ||
expected => | ||
[ | ||
'LocalTest', | ||
] | ||
}, | ||
{ | ||
name => '"directory" section.', | ||
distdir => 't/08-_get_packages_not_indexed/', | ||
no_index => | ||
{ | ||
'directory' => | ||
[ | ||
'LocalTest' | ||
] | ||
}, | ||
expected => | ||
[ | ||
'LocalTest::Test', | ||
] | ||
}, | ||
{ | ||
name => '"package" section.', | ||
distdir => 't/08-_get_packages_not_indexed/', | ||
no_index => | ||
{ | ||
'package' => | ||
[ | ||
'LocalTest' | ||
] | ||
}, | ||
expected => | ||
[ | ||
'LocalTest', | ||
] | ||
}, | ||
{ | ||
name => '"namespace" section.', | ||
distdir => 't/08-_get_packages_not_indexed/', | ||
no_index => | ||
{ | ||
'namespace' => | ||
[ | ||
'LocalTest', | ||
] | ||
}, | ||
expected => | ||
[ | ||
'LocalTest', | ||
'LocalTest::Test', | ||
] | ||
}, | ||
]; | ||
|
||
plan(tests => scalar(@$tests)+1); | ||
|
||
use_ok('Module::CPANTS::Analyse'); | ||
|
||
foreach my $test (@$tests) { | ||
# Prepare the Module::CPANTS::Analyse with the specific no_index information | ||
# for this test. | ||
my $d = bless( | ||
{ | ||
'meta_yml' => | ||
{ | ||
'no_index' => $test->{'no_index'}, | ||
}, | ||
'uses' => | ||
{ | ||
'File::Spec' => { | ||
'in_code' => 1, | ||
'in_tests' => 0, | ||
'module' => 'File::Spec' | ||
}, | ||
'LocalTest' => { | ||
'in_code' => 0, | ||
'in_tests' => 1, | ||
'module' => 'LocalTest' | ||
}, | ||
'LocalTest::Test' => { | ||
'in_code' => 0, | ||
'in_tests' => 1, | ||
'module' => 'LocalTest::Test' | ||
}, | ||
}, | ||
}, | ||
'Module::CPANTS::Analyse', | ||
); | ||
|
||
# Retrieve a list of packages used by the distribution but not indexed | ||
# according to META.yml. | ||
my $packages_not_indexed = Test::Kwalitee::Extra::_get_packages_not_indexed( | ||
d => $d, | ||
distdir => $test->{'distdir'}, | ||
); | ||
|
||
# Make sure the function identified the packages not indexed correctly. | ||
is_deeply( | ||
$packages_not_indexed, | ||
$test->{'expected'}, | ||
$test->{'name'}, | ||
) || diag(explain('Expected: ', $test->{'expected'}, 'Found: ', $packages_not_indexed)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package LocalTest; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package LocalTest::Test; | ||
|
||
1; |