This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Module-Metadata to 1.000011
[perl5.git] / cpan / Module-Metadata / t / encoding.t
1 #!perl
2
3 use strict;
4 use File::Spec;
5 use Test::More;
6
7 use Module::Metadata;
8
9 if ("$]" < 5.008_003) {
10   plan skip_all => 'Encoding test needs at least perl 5.8.3';
11 }
12
13 my %versions = (
14  UTF8    => 3,
15  UTF16BE => 4,
16  UTF16LE => 5,
17 );
18
19 plan tests => 4 * scalar(keys %versions);
20
21 for my $enc (sort keys %versions) {
22   my $pkg  = "BOMTest::$enc";
23   my $vers = $versions{$enc};
24   my $pm   = File::Spec->catfile(qw<t lib BOMTest> => "$enc.pm");
25   my $info = Module::Metadata->new_from_file($pm);
26   is( $info->name, $pkg, "$enc: default package was found" );
27   is( $info->version, $vers, "$enc: version for default package" );
28   is( $info->version('Heart'), '1', 'version for ASCII package' );
29   is( $info->version("C\x{153}ur"), '2', 'version for Unicode package' );
30 }