Locale-Utils-PlaceholderMaketext

 view release on metacpan or  search on metacpan

t/21_expand_maketext.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;

use Test::More tests => 32;
use Test::NoWarnings;
use Test::Differences;
BEGIN {
    use_ok 'Locale::Utils::PlaceholderMaketext';
}

my $obj = Locale::Utils::PlaceholderMaketext->new;

is_deeply
    [ $obj->expand_maketext(undef) ],
    [ undef ],
    'undef';

eq_or_diff
    $obj->expand_maketext(
        '[_1];[quant,_2,s];[quant,_3,s,p];[quant,_4,s,p,z]',
        undef,
        undef,
        'three',
        '4_234_567.890',
        4234567.890,
    ),
    ';0 s;0 p;z',
    'no strict array';

eq_or_diff
    $obj->expand_maketext(
        '[_1];[quant,_2,s];[quant,_3,s,p];[quant,_4,s,p,z]',
        [
            undef,
            undef,
            'three',
            '4_234_567.890',
            4234567.890,
        ],
    ),
    ';0 s;0 p;z',
    'no strict array_ref';

eq_or_diff
    $obj->expand_maketext(
        '~~;~[_1~];~[quant,_2,s~];~[*,_3,s,p~];~[#,4~]',
        1 .. 4,
    ),
    '~;[_1];[quant,_2,s];[*,_3,s,p];[#,4]',
    'escaped';

$obj->space(q{x});

eq_or_diff
    $obj->expand_maketext(
        '[quant,_1,s];[quant,_2,s,p]',
        1,
        2,
    ),
    '1xs;2xp',
    'space is x';

$obj->reset_space;
$obj->is_strict(1);

$obj->formatter_code(



( run in 1.535 second using v1.01-cache-2.11-cpan-7f9471e7e0a )