comparison _test/Test/Resources/Format.pm @ 18:818c74b038ae

DOM Schema + tests
author Sergey
date Thu, 10 Sep 2009 17:42:47 +0400
parents
children 16ada169ca75
comparison
equal deleted inserted replaced
17:7f88e01b58f8 18:818c74b038ae
1 package Test::Resources::Format;
2 use strict;
3 use warnings;
4
5 use base qw(IMPL::Test::Unit);
6 use IMPL::Test qw(test failed);
7 use IMPL::Resources::Format qw(FormatMessage);
8
9 __PACKAGE__->PassThroughArgs;
10
11 {
12 package Args;
13 use base qw(IMPL::Object);
14
15 sub foo {
16 return { name => 'Args::foo', value => 'some value'}
17 }
18 }
19
20 test FormatMessage => sub {
21 my $format = 'This is a %name% message. %args.foo.name% has %args.foo.value% and %some.unknown.param%';
22
23 my $args = {
24 name => 'Test',
25 args => new Args()
26 };
27
28 my $result = FormatMessage($format,$args);
29 my $expected = 'This is a Test message. Args::foo has some value and [some.unknown.param]';
30
31 failed
32 "Format message returned unexpected results",
33 "Expected: $expected",
34 "Recieved: $result"
35 unless $result eq $expected;
36 };
37
38
39 1;