/[webpac2]/trunk/t/5-output-tt.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/5-output-tt.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/t/4-output-tt.t revision 16 by dpavlin, Sun Jul 17 11:37:07 2005 UTC trunk/t/5-output-tt.t revision 949 by dpavlin, Thu Nov 1 00:16:48 2007 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
 use Test::More tests => 5;  
 use Test::Exception;  
 use Cwd qw/abs_path/;  
 use blib;  
3  use strict;  use strict;
4    use blib;
5    
6    use Test::More tests => 5;
7    
8  BEGIN {  BEGIN {
9    use_ok( 'WebPAC::Test' );
10  use_ok( 'WebPAC::Output::TT' );  use_ok( 'WebPAC::Output::TT' );
11  }  }
12    
 ok(my $abs_path = abs_path($0), "abs_path");  
 $abs_path =~ s#/[^/]*$#/#;  
 diag "abs_path: $abs_path";  
   
13  ok(my $tt = new WebPAC::Output::TT(  ok(my $tt = new WebPAC::Output::TT(
14          include_path => "$abs_path../conf/output/tt",          include_path => "$abs_path../conf/output/tt",
15          debug => 1 ),          %LOG
16  "new");  ), "new");
17    
18  my @ds = [ {  my $ds = {
19          'name' => 'Izvor: ',          'Source' => {
20          'tag' => 'Source',                  'name' => 'Izvor: ',
21          'display' => [ 'foo' ]                  'tag' => 'Source',
22          }, {                  'display' => [ 'foo' ]
23          'name' => 'ID',                  },
24          'tag' => 'IDths',          'ID' => {
25          'swish' => [ 'bar' ],                  'name' => 'ID',
26          'lookup_key' => [ 'bar' ]                  'tag' => 'IDths',
27          }, {                  'search' => [ 'bar' ],
28                    'lookup_key' => [ 'bar' ]
29                    },
30          'filename' => [ 'out/thes/001.html' ],          'filename' => [ 'out/thes/001.html' ],
31          'name' => 'filename',          'name' => 'filename',
32          'tag' => 'filename'          'tag' => 'filename'
33          },  };
 ];  
34    
35  throws_ok { $tt->apply( template => 'foo', data => [] ) } qr/error.*foo/, "apply without template";  throws_ok { $tt->apply( template => 'foo', data => [] ) } qr/error.*foo/, "apply without template";
36    
37  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");
38    
39  diag $text;  diag $text if $debug;
40    

Legend:
Removed from v.16  
changed lines
  Added in v.949

  ViewVC Help
Powered by ViewVC 1.1.26