xref: /openbsd-src/gnu/usr.bin/perl/cpan/Module-Metadata/t/encoding.t (revision 5ad04d351680822078003e2b066cfc9680d6157d)
1#!perl
2
3use strict;
4use File::Spec;
5use Test::More;
6
7use Module::Metadata;
8
9if ("$]" < 5.008_003) {
10  plan skip_all => 'Encoding test needs at least perl 5.8.3';
11}
12
13my %versions = (
14 UTF8    => 3,
15 UTF16BE => 4,
16 UTF16LE => 5,
17);
18
19plan tests => 4 * scalar(keys %versions);
20
21for 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}
31