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