1#============================================================= -*-perl-*-
2#
3# t/plufile.t
4#
5# Test ability to specify INCLUDE/PROCESS/WRAPPER files in the 
6# form "foo+bar+baz".
7#
8# Written by Andy Wardley <abw@kfs.org>
9#
10# Copyright (C) 1996-2000 Andy Wardley.  All Rights Reserved.
11# Copyright (C) 1998-2000 Canon Research Centre Europe Ltd.
12#
13# This is free software; you can redistribute it and/or modify it
14# under the same terms as Perl itself.
15#
16# $Id$
17#
18#========================================================================
19
20use strict;
21use lib qw( ./lib ../lib );
22use Template;
23use Template::Test;
24use Template::Context;
25$^W = 1;
26
27#$Template::Parser::DEBUG = 1;
28#$Template::Directive::PRETTY = 1;
29$Template::Test::PRESERVE = 1;
30
31my $dir = -d 't' ? 't/test/src' : 'test/src';
32
33test_expect(\*DATA, { INCLUDE_PATH => $dir  });
34
35__DATA__
36-- test --
37[% INCLUDE foo %]
38[% BLOCK foo; "This is foo!"; END %]
39-- expect --
40This is foo!
41
42-- test --
43[% INCLUDE foo+bar -%]
44[% BLOCK foo; "This is foo!\n"; END %]
45[% BLOCK bar; "This is bar!\n"; END %]
46-- expect --
47This is foo!
48This is bar!
49
50-- test --
51[% PROCESS foo+bar -%]
52[% BLOCK foo; "This is foo!\n"; END %]
53[% BLOCK bar; "This is bar!\n"; END %]
54-- expect --
55This is foo!
56This is bar!
57
58-- test --
59[% WRAPPER edge + box + indent
60     title = "The Title" -%]
61My content
62[% END -%]
63[% BLOCK indent -%]
64<indent>
65[% content -%]
66</indent>
67[% END -%]
68[% BLOCK box -%]
69<box>
70[% content -%]
71</box>
72[% END -%]
73[% BLOCK edge -%]
74<edge>
75[% content -%]
76</edge>
77[% END -%]
78-- expect --
79<edge>
80<box>
81<indent>
82My content
83</indent>
84</box>
85</edge>
86
87
88-- test --
89[% INSERT foo+bar/baz %]
90-- expect --
91This is the foo file, a is [% a -%][% DEFAULT word = 'qux' -%]
92This is file baz
93The word is '[% word %]'
94
95-- test --
96[% file1 = 'foo'
97   file2 = 'bar/baz'
98-%]
99[% INSERT "$file1" + "$file2" %]
100-- expect --
101This is the foo file, a is [% a -%][% DEFAULT word = 'qux' -%]
102This is file baz
103The word is '[% word %]'
104
105