Locale-TextDomain-OO-Extract

 view release on metacpan or  search on metacpan

t/21_process_utf-8.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;
use utf8;

use Test::More;
use Test::Differences;
use Path::Tiny qw(path);

$ENV{AUTHOR_TESTING}
    or plan skip_all => 'Set $ENV{AUTHOR_TESTING} to run this test.';
plan tests => 12;
require Test::NoWarnings;
Test::NoWarnings->import;

use_ok('Locale::TextDomain::OO::Extract::Perl');
use_ok('Locale::TextDomain::OO::Extract::Process');

my @languages = qw( de de-at );
my $category  = 'LC_MESSAGES';
my @domains   = qw( test1 test2 );
my %suffix_of = qw( test1 po test2 mo );

my $process = Locale::TextDomain::OO::Extract::Process->new(
    category => $category, # in this test unchanged
);
$process->add_plugin(mo => 'MO');

for my $domain (@domains) {
    $process->domain($domain); # in this test changed then not in constructor
    for my $language (@languages) {
        $process->language($language);  # in this test changed then not in constructor
        $process->slurp( $suffix_of{$domain} => "./t/LocaleData/$language/$category/$domain.$suffix_of{$domain}" );
    }
}

my $expected_lexicon_ref = {
    'de-at:LC_MESSAGES:test1' => {
        q{} => {
            msgstr => <<"EOT",
Project-Id-Version:\x20
POT-Creation-Date:\x20
PO-Revision-Date:\x20
Last-Translator:\x20
Language-Team:\x20
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=2; plural=n != 1;
EOT
            nplurals => 2,
            plural => 'n != 1',
        },
        January => {
            automatic => 'automatic 2
automatic 1',
            comment => 'comment 2
comment 1',
            msgstr => 'Jänner',
            reference => 'old/file.pl:3 old/file.pl:2
old/file.pl:1
old/file.pl:456',
        },
    },
    'de-at:LC_MESSAGES:test2' => {
        q{} => {
            msgstr => <<"EOT",



( run in 1.338 second using v1.01-cache-2.11-cpan-39bf76dae61 )