10 # these dirs must be in order to the deepest for rmdir to work properly
12 my @tmpl_dirs = qw( templates templates/deeper templates/deeper/deepest ) ;
16 'templates/FOO.tmpl' => <<FOO,
17 this loads bar <[%include BAR%]>
19 'templates/deeper/BAR.tmpl' => <<BAR,
22 'templates/deeper/deepest/BAR.tmpl' => <<BAR,
23 [this should be hidden then revealed]
30 name => 'simple include',
38 template => '[%INCLUDE foo%]',
42 name => 'nested includes',
46 foo => '[%include bar%]',
51 template => '[%INCLUDE foo%]',
55 name => 'serial includes',
61 quux => 'quux is on the drums',
65 template => '[%INCLUDE foo%] [%INCLUDE bar%] [%INCLUDE quux%]',
66 expected => 'foo is here bar is too quux is on the drums',
69 name => 'missing include',
73 pretest => sub { $_[0]{obj}->delete_templates() },
74 error => qr/can't find/,
77 name => 'load include files',
83 templates/deeper/deepest
87 template => '[%INCLUDE FOO%]',
88 expected => <<EXPECTED,
89 this loads bar <{this should hide}
95 name => 'use lower path',
98 include_paths => [ qw(
100 templates/deeper/deepest
104 expected => <<EXPECTED,
105 this loads bar <[this should be hidden then revealed]
111 name => 'delete covering file',
117 templates/deeper/deepest
120 pretest => sub { unlink 'templates/deeper/BAR.tmpl' },
121 posttest => sub { write_tmpl_files() },
124 expected => <<EXPECTED,
125 this loads bar <[this should be hidden then revealed]
135 template_tester( $tests ) ;
137 #remove_tmpl_files() ;
142 sub write_tmpl_files {
144 mkdir $_, 0755 for @tmpl_dirs ;
146 while( my( $file, $tmpl ) = each %tmpl_files ) {
148 write_file( $file, $tmpl ) ;
152 sub remove_tmpl_files {
154 unlink keys %tmpl_files ;
155 rmdir $_ for reverse @tmpl_dirs ;