X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F5-output-tt.t;h=a2b8d8a1c69c05839a5a057d1cc6d61604a58598;hb=5d5fc808565b88bca0e2d10aa62bd89c7e748743;hp=318c6b5bc52372c275de8349047f7d9753387e1b;hpb=f958b4b5cf3be8dec2e8e0909efff5b303ba2545;p=webpac2 diff --git a/t/5-output-tt.t b/t/5-output-tt.t index 318c6b5..a2b8d8a 100755 --- a/t/5-output-tt.t +++ b/t/5-output-tt.t @@ -1,43 +1,40 @@ #!/usr/bin/perl -w -use Test::More tests => 5; -use Test::Exception; -use Cwd qw/abs_path/; -use blib; use strict; +use blib; + +use Test::More tests => 5; BEGIN { +use_ok( 'WebPAC::Test' ); use_ok( 'WebPAC::Output::TT' ); } -ok(my $abs_path = abs_path($0), "abs_path"); -$abs_path =~ s#/[^/]*$#/#; -diag "abs_path: $abs_path"; - ok(my $tt = new WebPAC::Output::TT( include_path => "$abs_path../conf/output/tt", - debug => 1 ), -"new"); - -my @ds = [ { - 'name' => 'Izvor: ', - 'tag' => 'Source', - 'display' => [ 'foo' ] - }, { - 'name' => 'ID', - 'tag' => 'IDths', - 'swish' => [ 'bar' ], - 'lookup_key' => [ 'bar' ] - }, { + %LOG +), "new"); + +my $ds = { + 'Source' => { + 'name' => 'Izvor: ', + 'tag' => 'Source', + 'display' => [ 'foo' ] + }, + 'ID' => { + 'name' => 'ID', + 'tag' => 'IDths', + 'search' => [ 'bar' ], + 'lookup_key' => [ 'bar' ] + }, 'filename' => [ 'out/thes/001.html' ], 'name' => 'filename', 'tag' => 'filename' - }, -]; +}; throws_ok { $tt->apply( template => 'foo', data => [] ) } qr/error.*foo/, "apply without template"; -cmp_ok(my $text = $tt->apply( template => 'text.tt', data => @ds ), '=~', qr/Source.*foo/, "apply"); +cmp_ok(my $text = $tt->apply( template => 'text.tt', data => $ds ), '=~', qr/Source.*foo/, "apply"); -diag $text; +diag $text if $debug;