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

DOM Schema + tests
author Sergey
date Thu, 10 Sep 2009 17:42:47 +0400
parents
children 16ada169ca75
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Test/Resources/Format.pm	Thu Sep 10 17:42:47 2009 +0400
@@ -0,0 +1,39 @@
+package Test::Resources::Format;
+use strict;
+use warnings;
+
+use base qw(IMPL::Test::Unit);
+use IMPL::Test qw(test failed);
+use IMPL::Resources::Format qw(FormatMessage);
+
+__PACKAGE__->PassThroughArgs;
+
+{
+    package Args;
+    use base qw(IMPL::Object);
+    
+    sub foo {
+        return { name => 'Args::foo', value => 'some value'}
+    }
+}
+
+test FormatMessage => sub {
+    my $format = 'This is a %name% message. %args.foo.name% has %args.foo.value% and %some.unknown.param%';
+    
+    my $args = {
+        name => 'Test',
+        args => new Args()
+    };
+    
+    my $result = FormatMessage($format,$args);
+    my $expected = 'This is a Test message. Args::foo has some value and [some.unknown.param]';
+    
+    failed
+        "Format message returned unexpected results",
+        "Expected: $expected",
+        "Recieved: $result"
+    unless $result eq $expected;
+};
+
+
+1;