changeset 183:2184fa28b49e

IMPL::Web::View::TTLoader tests
author cin
date Wed, 28 Mar 2012 17:28:51 +0400
parents adc7669172c4
children 7525ea9a071a
files Lib/IMPL/Test/Unit.pm _test/Test/Web/View.pm _test/Web.t
diffstat 3 files changed, 56 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/Test/Unit.pm	Mon Mar 26 02:01:05 2012 +0400
+++ b/Lib/IMPL/Test/Unit.pm	Wed Mar 28 17:28:51 2012 +0400
@@ -9,9 +9,10 @@
 
 use Error qw(:try);
 use Carp qw(carp);
-use IMPL::Test::Result;
-use IMPL::Test::FailException;
-use IMPL::Exception;
+use File::Spec();
+use IMPL::Test::Result();
+use IMPL::Test::FailException();
+use IMPL::Exception();
 
 BEGIN {
     public property Name => prop_all;
@@ -109,6 +110,20 @@
     }
 }
 
+sub GetResourceFile {
+	my ($this,@path) = @_;
+	
+	my ($cwd) = map m/(.*)/, File::Spec->rel2abs(File::Spec->curdir());
+	return File::Spec->catfile(@path);
+}
+
+sub GetResourceDir {
+	my ($this,@path) = @_;
+	
+	my ($cwd) = map m/(.*)/, File::Spec->rel2abs(File::Spec->curdir());
+	return File::Spec->catdir(@path);
+}
+
 package IMPL::Test::Unit::TestInfo;
 use parent qw(IMPL::Object::Meta);
 use IMPL::Class::Property;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Test/Web/View.pm	Wed Mar 28 17:28:51 2012 +0400
@@ -0,0 +1,32 @@
+package Test::Web::View;
+use strict;
+use warnings;
+
+use parent qw(IMPL::Test::Unit);
+__PACKAGE__->PassThroughArgs;
+
+use IMPL::Test qw(assert test);
+use IMPL::Web::View::TTLoader();
+
+use constant {
+	TTLoader => typeof IMPL::Web::View::TTLoader
+};
+
+test TemplateLoaderTests => sub {
+	my ($this) = @_;
+	
+	my $loader = TTLoader->new(
+		{
+			INCLUDE_PATH => [
+				$this->GetResourceDir('Resources')
+			]
+		},
+		ext => '.tt'
+	);
+	
+	assert( defined(my $tt = $loader->template('simple') ) );
+	
+	$tt;	
+};
+
+1;
\ No newline at end of file
--- a/_test/Web.t	Mon Mar 26 02:01:05 2012 +0400
+++ b/_test/Web.t	Wed Mar 28 17:28:51 2012 +0400
@@ -3,13 +3,11 @@
 use lib '../Lib';
 use lib '.';
 
-use IMPL::Test::Plan;
-use IMPL::Test::TAPListener;
+use IMPL::Test qw(run_plan);
+
 
-my $plan = new IMPL::Test::Plan qw(
+
+run_plan( qw(
     Test::Web::TT
-);
-
-$plan->AddListener(new IMPL::Test::TAPListener);
-$plan->Prepare();
-$plan->Run();
+    Test::Web::View
+) );