annotate _test/Test/Resources/Strings.pm @ 378:2eed076cb944

rewritten IMPL::Resources::Strings + tests
author cin
date Wed, 15 Jan 2014 17:20:54 +0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
378
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
1 package Test::Resources::Strings;
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
2 use strict;
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
3
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
4 use IMPL::Test qw(assert test);
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
5 use IMPL::declare {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
6 require => {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
7 Resources => 'IMPL::Resources'
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
8 },
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
9 base => [
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
10 'IMPL::Test::Unit' => '@_'
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
11 ]
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
12 };
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
13
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
14 use IMPL::Resources::Strings {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
15 HelloMessage => "Hello, %name%!",
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
16 TitleLabel => "Hellow world!"
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
17 };
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
18
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
19 test TestDefaultMessage => sub {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
20 assert( HelloMessage( name => 'John') eq "Hello, John!" );
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
21 };
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
22
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
23 test TestPlainResourceFile => sub{
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
24 Resources->InvokeInLocale(en_INF1 => sub {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
25 assert( HelloMessage( name => 'Peter' ) eq "Hi, Peter!" );
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
26 assert( TitleLabel, "Hellow world!");
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
27 });
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
28 };
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
29
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
30 test TestPerlResourceFile => sub {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
31 Resources->InvokeInLocale(en_INF2 => sub {
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
32 assert( HelloMessage( name => 'Sam' ) eq "I know you, Sam!");
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
33 });
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
34 };
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
35
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents:
diff changeset
36 1;