This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to version-0.7203.
[perl5.git] / lib / Module / Build / t / metadata.t
index 0e4fe39..4166092 100644 (file)
@@ -2,7 +2,7 @@
 
 use strict;
 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 46;
+use MBTest tests => 47;
 
 use Cwd ();
 my $cwd = Cwd::cwd;
@@ -138,6 +138,21 @@ is_deeply($mb->find_dist_packages,
           'Foo::Bar' => { file => 'lib/Simple.pm',
                           version => '1.23' }});
 
+{
+  $dist->change_file( 'lib/Simple.pm', <<'---' );
+package Simple;
+$VERSION = version->new('0.60.' . (qw$Revision: 128 $)[1]);
+package Simple::Simon;
+$VERSION = version->new('0.61.' . (qw$Revision: 129 $)[1]);
+---
+  $dist->regen;
+  my $provides = new_build()->prepare_metadata()->{provides};
+  is $provides->{'Simple'}{version}, '0.60.128', "Check version";
+  is $provides->{'Simple::Simon'}{version}, '0.61.129', "Check version";
+  is ref($provides->{'Simple'}{version}), '', "Versions from prepare_metadata() aren't refs";
+  is ref($provides->{'Simple::Simon'}{version}), '', "Versions from prepare_metadata() aren't refs";
+}
+
 
 # Single file with multiple differing packages, no corresponding package
 # Simple.pm => Foo
@@ -556,15 +571,6 @@ $dist->regen( clean => 1 );
 $mb = new_build();
 is_deeply($mb->find_dist_packages, {});
 
-
-{
-  # Put our YAML escaper through a few tests.  This isn't part of the M::B API.
-  my $yq = sub {Module::Build->_yaml_quote_string(@_)};
-  like $yq->(''), qr{^ (['"]) \1 $}x;
-  is $yq->('Foo "bar" baz'), q{'Foo "bar" baz'};
-  is $yq->("Foo 'bar' baz"), q{"Foo 'bar' baz"};
-}
-
 ############################################################
 # cleanup
 chdir( $cwd ) or die "Can't chdir to '$cwd': $!";