Mercurial > pub > Impl
comparison _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 |
comparison
equal
deleted
inserted
replaced
377:a0d342ac9a36 | 378:2eed076cb944 |
---|---|
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; |