/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (show annotations)
Sat Nov 19 23:48:24 2005 UTC (18 years, 5 months ago) by dpavlin
File MIME type: application/x-troff
File size: 876 byte(s)
 r8980@llin:  dpavlin | 2005-11-20 00:49:22 +0100
 implement data_structure that returns HASH and not ARRAY.
 
 Little explanation for this rationale:
 
 Array was needed back in WebPAC v1 because order of tags in import_xml was
 important. However, since we are no longer depending on order of tags in
 input/*.xml, hash is much better choice.

1 #!/usr/bin/perl -w
2
3 use Test::More tests => 5;
4 use Test::Exception;
5 use Cwd qw/abs_path/;
6 use blib;
7 use strict;
8
9 BEGIN {
10 use_ok( 'WebPAC::Output::TT' );
11 }
12
13 ok(my $abs_path = abs_path($0), "abs_path");
14 $abs_path =~ s#/[^/]*$#/#;
15 diag "abs_path: $abs_path";
16
17 ok(my $tt = new WebPAC::Output::TT(
18 include_path => "$abs_path../conf/output/tt",
19 no_log => 1,
20 ), "new");
21
22 my $ds = {
23 'Source' => {
24 'name' => 'Izvor: ',
25 'tag' => 'Source',
26 'display' => [ 'foo' ]
27 },
28 'ID' => {
29 'name' => 'ID',
30 'tag' => 'IDths',
31 'swish' => [ 'bar' ],
32 'lookup_key' => [ 'bar' ]
33 },
34 'filename' => [ 'out/thes/001.html' ],
35 'name' => 'filename',
36 'tag' => 'filename'
37 };
38
39 throws_ok { $tt->apply( template => 'foo', data => [] ) } qr/error.*foo/, "apply without template";
40
41 cmp_ok(my $text = $tt->apply( template => 'text.tt', data => $ds ), '=~', qr/Source.*foo/, "apply");
42
43 diag $text;
44

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26