Amon2-Plugin-L10N
view release on metacpan or search on metacpan
t/01_simple.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'en' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'en' ],
));
is $res->content, 'Hello, yappo';
}
);
};
subtest 'ja' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'en;q=0.1, ja;q=0.12' ],
));
is $res->content, 'yappo ãããããã«ã¡ã¯';
}
);
};
subtest 'default' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'th' ],
));
is $res->content, 'Hello, yappo';
}
);
};
done_testing;
t/02_before_hook.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'ja' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/?lang=ja',
[ 'Accept-Language', 'en' ],
));
is $res->content, 'yappo ãããããã«ã¡ã¯';
}
);
};
subtest 'th' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/?lang=th',
[ 'Accept-Language', 'ja' ],
));
is $res->content, 'สวัสà¸à¸µà¸à¸²à¸¢ yappo';
}
);
};
subtest 'default' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/?lang=fr',
[ 'Accept-Language', 'ja' ],
));
is $res->content, 'Hello, yappo';
}
);
};
done_testing;
t/03_after_hook.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'th' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'th' ],
));
is $res->content, 'yappo ãããããã«ã¡ã¯';
}
);
};
subtest 'ja' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'ja' ],
));
is $res->content, 'สวัสà¸à¸µà¸à¸²à¸¢ yappo';
}
);
};
subtest 'default' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'fr' ],
));
is $res->content, 'Hello, yappo';
}
);
};
done_testing;
t/04_default_lang.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'ja th' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/?before=ja',
[],
));
is $res->content, 'yappo ãããããã«ã¡ã¯';
}
);
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/?after=th',
[],
));
is $res->content, 'สวัสà¸à¸µà¸à¸²à¸¢ yappo';
}
);
};
subtest 'default' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/?after=out',
[],
));
is $res->content, 'Hello, %1, yappo';
}
);
};
{
t/04_default_lang.t view on Meta::CPAN
}
}
my $app2 = MyApp2::Web->to_app;
subtest 'en' => sub {
test_psgi(
app => $app2,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[],
));
is $res->content, 'Hello yappo';
}
);
};
{
package MyApp3;
t/04_default_lang.t view on Meta::CPAN
}
}
my $app3 = MyApp3::Web->to_app;
subtest 'ja' => sub {
test_psgi(
app => $app3,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[],
));
is $res->content, 'Japan Hello, yappo';
}
);
};
done_testing;
t/05_l10n_class.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'ja' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'ja' ],
));
is $res->content, 'yappo ãããããã«ã¡ã¯';
}
);
};
done_testing;
t/06_lexicon_options.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'good' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'ja' ],
));
is $res->content, 'good';
}
);
};
{
t/06_lexicon_options.t view on Meta::CPAN
}
}
my $app2 = MyApp2::Web->to_app;
subtest 'bad' => sub {
test_psgi(
app => $app2,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'ja' ],
));
like $res->content, qr/bad exception/;
}
);
};
done_testing;
t/07_po_file_langs.t view on Meta::CPAN
}
}
my $app = MyApp::Web->to_app;
subtest 'en-us' => sub {
test_psgi(
app => $app,
client => sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(
GET => 'http://localhost/',
[ 'Accept-Language', 'en-us' ],
));
is $res->content, 'Hello, yappo';
}
);
};
done_testing;
( run in 0.534 second using v1.01-cache-2.11-cpan-de7293f3b23 )