Locale-TextDomain-OO

 view release on metacpan or  search on metacpan

t/15_gettext_N__.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;

use Test::More tests => 11;
use Test::NoWarnings;
use Test::Differences;

BEGIN {
    require_ok('Locale::TextDomain::OO');
}

my $loc = Locale::TextDomain::OO->new(
    plugins => [ qw( Expand::Gettext ) ],
);
is
    $loc->N__('This is a text.'),
    'This is a text.',
    'N__ scalar context';
eq_or_diff
    [
        $loc->N__(
            'This is a text.',
        ),
    ],
    [ 
        'This is a text.',
    ],
    'N__ list context';
eq_or_diff
    [
        $loc->N__x(
            '{name} is programming {language}.',
            name     => 'Steffen',
            language => 'Perl',
        ),
    ],
    [
        '{name} is programming {language}.',
        name     => 'Steffen',
        language => 'Perl',
    ],
    'N__x';
eq_or_diff
    [
        $loc->N__n(
            'Singular',
            'Plural',
            1,
        ),
    ],
    [ qw( Singular Plural 1 ) ],
    'N__n';
eq_or_diff
    [
        $loc->N__nx(
            '{num} shelf',
            '{num} shelves',
            1,
            num => 1,
        ),
    ],
    [
        '{num} shelf',
        '{num} shelves',
        1,
        num => 1,



( run in 2.705 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )