Locale-TextDomain-OO-Extract
view release on metacpan or search on metacpan
t/12_extract_tt_utf-8.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use utf8;
use Test::More tests => 8;
use Test::NoWarnings;
use Test::Exception;
use Test::Differences; local $Data::Dumper::Useperl = 1;
use Path::Tiny qw(path);
BEGIN {
use_ok('Locale::TextDomain::OO::Extract::TT');
}
my $extractor;
lives_ok
sub {
$extractor = Locale::TextDomain::OO::Extract::TT->new;
},
'create extractor object';
for ( qw( babelfish_loc gettext gettext_loc maketext_l ) ) {
lives_ok
sub {
$extractor->filename("$_.tt");
$extractor->content_ref(
\( path("./t/files_to_extract/$_.tt")->slurp_utf8 ),
);
$extractor->extract;
},
'extract $_.tt';
}
my $expected_lexicon_ref = {
'i-default::' => {
q{} => {
msgstr => {
nplurals => 2,
plural => 'n != 1',
},
},
'#{name} is programming #{language}.' => {
automatic => q{name => 'Steffen', language => 'Perl',},
reference => {
'babelfish_loc.tt:22' => undef,
},
},
'#{num :num} ((date|dates))' => {
automatic => 'num => 2,',
reference => {
'babelfish_loc.tt:39' => undef,
},
},
'#{num} ((date|dates)):num' => {
automatic => 'num => 1,',
reference => {
'babelfish_loc.tt:35' => undef,
},
},
"#{num} date\x04appointment" => {
automatic => 'num => 1,',
reference => {
'babelfish_loc.tt:47' => undef,
},
},
'((Singular|Plural))' => {
automatic => '1,',
reference => {
( run in 2.267 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )