view _test/Test/Resources/Format.pm @ 63:76b878ad6596

Added serialization support for the IMPL::Object::List More intelligent Exception message Fixed encoding support in the actions Improoved tests Minor fixes
author wizard
date Mon, 15 Mar 2010 02:38:09 +0300
parents 16ada169ca75
children 4267a2ac3d46
line wrap: on
line source

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;