diff _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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Test/Resources/Strings.pm	Wed Jan 15 17:20:54 2014 +0400
@@ -0,0 +1,36 @@
+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;
\ No newline at end of file