);
my %modules = reverse @modules;
-plan tests => 39 + 2 * keys( %modules );
+plan tests => 40 + 2 * keys( %modules );
require_ok('Module::Metadata');
$VERSION = '0.01';
package Simple::Ex;
$VERSION = '0.02';
+
=head1 NAME
Simple - It's easy.
is( $pm_info->version('Simple::Simon'), '0.61.129', 'version for embedded package' );
}
+# check that package_versions_from_directory works
+
+$dist->change_file( 'lib/Simple.pm', <<'---' );
+package Simple;
+$VERSION = '0.01';
+package Simple::Ex;
+$VERSION = '0.02';
+{
+ package main; # should ignore this
+}
+{
+ package DB; # should ignore this
+}
+{
+ package Simple::_private; # should ignore this
+}
+
+=head1 NAME
+
+Simple - It's easy.
+
+=head1 AUTHOR
+
+Simple Simon
+
+=cut
+---
+$dist->regen;
+
+my $exp_pvfd = {
+ 'Simple' => {
+ 'file' => 'Simple.pm',
+ 'version' => '0.01'
+ },
+ 'Simple::Ex' => {
+ 'file' => 'Simple.pm',
+ 'version' => '0.02'
+ }
+};
+
+my $got_pvfd = Module::Metadata->package_versions_from_directory('lib');
+
+is_deeply( $got_pvfd, $exp_pvfd, "package_version_from_directory" )
+ or diag explain $got_pvfd;