378
|
1 package Test::Resources::Strings;
|
|
2 use strict;
|
|
3
|
|
4 use IMPL::Test qw(assert test);
|
|
5 use IMPL::declare {
|
|
6 require => {
|
|
7 Resources => 'IMPL::Resources'
|
|
8 },
|
|
9 base => [
|
|
10 'IMPL::Test::Unit' => '@_'
|
|
11 ]
|
|
12 };
|
|
13
|
|
14 use IMPL::Resources::Strings {
|
|
15 HelloMessage => "Hello, %name%!",
|
|
16 TitleLabel => "Hellow world!"
|
|
17 };
|
|
18
|
|
19 test TestDefaultMessage => sub {
|
|
20 assert( HelloMessage( name => 'John') eq "Hello, John!" );
|
|
21 };
|
|
22
|
|
23 test TestPlainResourceFile => sub{
|
|
24 Resources->InvokeInLocale(en_INF1 => sub {
|
|
25 assert( HelloMessage( name => 'Peter' ) eq "Hi, Peter!" );
|
|
26 assert( TitleLabel, "Hellow world!");
|
|
27 });
|
|
28 };
|
|
29
|
|
30 test TestPerlResourceFile => sub {
|
|
31 Resources->InvokeInLocale(en_INF2 => sub {
|
|
32 assert( HelloMessage( name => 'Sam' ) eq "I know you, Sam!");
|
|
33 });
|
|
34 };
|
|
35
|
|
36 1; |