# HG changeset patch # User cin # Date 1332941331 -14400 # Node ID 2184fa28b49e0ce7973a5097e01429ac0b093ca1 # Parent adc7669172c4af56847926d435aa8fb6ac6363ab IMPL::Web::View::TTLoader tests diff -r adc7669172c4 -r 2184fa28b49e Lib/IMPL/Test/Unit.pm --- 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; diff -r adc7669172c4 -r 2184fa28b49e _test/Test/Web/View.pm --- /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 diff -r adc7669172c4 -r 2184fa28b49e _test/Web.t --- 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 +) );