diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2012-02-08 09:29:02 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2012-02-08 12:28:32 +0000 |
commit | 75ff595642748dcb643b414930500bbce695c074 (patch) | |
tree | a70a18c8d60b0597f81f06424e946ab216994957 /cpan/Module-Metadata/t/metadata.t | |
parent | d0a4cc40ecf613f5edf08970fd1ffa34dffc2de3 (diff) | |
download | perl-75ff595642748dcb643b414930500bbce695c074.tar.gz |
Update Module-Metadata to CPAN version 1.000008
[DELTA]
1.0.8 2012-02-07 22:30:00
- Adds 'provides' method to generate a CPAN META provides data structure
correctly; use of package_versions_from_directory is discouraged (DAGOLDEN)
Diffstat (limited to 'cpan/Module-Metadata/t/metadata.t')
-rw-r--r-- | cpan/Module-Metadata/t/metadata.t | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/cpan/Module-Metadata/t/metadata.t b/cpan/Module-Metadata/t/metadata.t index c0e0f12464..b93cefbe78 100644 --- a/cpan/Module-Metadata/t/metadata.t +++ b/cpan/Module-Metadata/t/metadata.t @@ -203,7 +203,7 @@ package Simple v1.2.3_4 { ); my %modules = reverse @modules; -plan tests => 39 + 2 * keys( %modules ); +plan tests => 42 + 2 * keys( %modules ); require_ok('Module::Metadata'); @@ -411,6 +411,7 @@ package Simple; $VERSION = '0.01'; package Simple::Ex; $VERSION = '0.02'; + =head1 NAME Simple - It's easy. @@ -503,3 +504,81 @@ $VERSION = version->new('0.61.' . (qw$Revision: 129 $)[1]); 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; + +{ + my $got_provides = Module::Metadata->provides(dir => 'lib'); + my $exp_provides = { + 'Simple' => { + 'file' => 'lib/Simple.pm', + 'version' => '0.01' + }, + 'Simple::Ex' => { + 'file' => 'lib/Simple.pm', + 'version' => '0.02' + } + }; + + is_deeply( $got_provides, $exp_provides, "provides()" ) + or diag explain $got_provides; +} + +{ + my $got_provides = Module::Metadata->provides(dir => 'lib', prefix => 'other'); + my $exp_provides = { + 'Simple' => { + 'file' => 'other/Simple.pm', + 'version' => '0.01' + }, + 'Simple::Ex' => { + 'file' => 'other/Simple.pm', + 'version' => '0.02' + } + }; + + is_deeply( $got_provides, $exp_provides, "provides()" ) + or diag explain $got_provides; +} |