Locale-TextDomain-OO

 view release on metacpan or  search on metacpan

t/04_lexicon_store_JSON.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;

use Test::More tests => 30;
use Test::NoWarnings;
use Test::Differences;
use JSON qw(decode_json);

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

Locale::TextDomain::OO::Lexicon::Hash
    ->new(
        logger => sub { note shift },
    )
    ->lexicon_ref({
        '::' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "::\x00p\x04c" },
        ],
        ':cat1:' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => ":cat1:\x00p\x04c" },
        ],
        '::dom1' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "::dom1\x00p\x04c" },
        ],
        ':cat1:dom1' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => ":cat1:dom1\x00p\x04c" },
        ],
        'en::' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "en::\x00p\x04c" },
        ],
        'en:cat1:' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "en:cat1:\x00p\x04c" },
        ],
        'en::dom1' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "en::dom1\x00p\x04c" },
        ],
        'en:cat1:dom1' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "en:cat1:dom1\x00p\x04c" },
        ],
        'de:cat1:dom1' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "de:cat1:dom1\x00p\x04c" },
        ],
        'de:::project1' => [
            { msgid  => "", msgstr => "Content-Type: text/plain; charset=UTF-8\nPlural-Forms: nplurals=1; plural=0" },
            { msgid  => "de:::project1\x00p\x04c" },
        ],
    });

eq_or_diff
    [
        sort keys %{
            decode_json(
                Locale::TextDomain::OO::Lexicon::StoreJSON->new->copy->to_json,
            )



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