1use strict;
2use warnings;
3use File::Spec;
4use Test::More;
5
6use Module::Metadata;
7
8if ("$]" < 5.008_003) {
9  plan skip_all => 'Encoding test needs at least perl 5.8.3';
10}
11
12my %versions = (
13 UTF8    => 3,
14 UTF16BE => 4,
15 UTF16LE => 5,
16);
17
18plan tests => 4 * scalar(keys %versions);
19
20for my $enc (sort keys %versions) {
21  my $pkg  = "BOMTest::$enc";
22  my $vers = $versions{$enc};
23  my $pm   = File::Spec->catfile(qw<corpus BOMTest> => "$enc.pm");
24  my $info = Module::Metadata->new_from_file($pm);
25  is( $info->name, $pkg, "$enc: default package was found" );
26  is( $info->version, $vers, "$enc: version for default package" );
27  is( $info->version('Heart'), '1', 'version for ASCII package' );
28  is( $info->version("C\x{153}ur"), '2', 'version for Unicode package' );
29}
30