view _test/Test/Resources/Strings.pm @ 381:ced5937ff21a

Custom getters/setters support method names in theirs definitions Initial support for localizable labels in DOM schemas
author cin
date Wed, 22 Jan 2014 16:56:10 +0400
parents 2eed076cb944
children
line wrap: on
line source

package Test::Resources::Strings;
use strict;

use IMPL::Test qw(assert test);
use IMPL::declare {
	require => {
		Resources => 'IMPL::Resources'
	},
	base => [
		'IMPL::Test::Unit' => '@_'
	]
};

use IMPL::Resources::Strings {
	HelloMessage => "Hello, %name%!",
	TitleLabel => "Hellow world!"
};

test TestDefaultMessage => sub {
	assert( HelloMessage( name => 'John') eq "Hello, John!" );
};

test TestPlainResourceFile => sub{
	Resources->InvokeInLocale(en_INF1 => sub {
		assert( HelloMessage( name => 'Peter' ) eq "Hi, Peter!" );
		assert( TitleLabel, "Hellow world!");
	});
};

test TestPerlResourceFile => sub {
	Resources->InvokeInLocale(en_INF2 => sub {
		assert( HelloMessage( name => 'Sam' ) eq "I know you, Sam!");
	});
};

1;