token_re, include cleanup, git cleanup
[urisagit/Template-Simple.git] / t / include.t
index 4352416..d7ced74 100644 (file)
@@ -26,12 +26,10 @@ BAR
 ) ;
 
 my $tests = [
-
        {
                name    => 'simple include',
                skip    => 0,
                opts    => {
-
                        templates => {
                                'foo'   => 'bar',
                        }
@@ -67,7 +65,6 @@ my $tests = [
                template => '[%INCLUDE foo%] [%INCLUDE bar%] [%INCLUDE quux%]',
                expected => 'foo is here bar is too quux is on the drums',
        },
-
        {
                name    => 'missing include',
                skip    => 0,
@@ -76,12 +73,11 @@ my $tests = [
                pretest => sub { $_[0]{obj}->delete_templates() },
                error   => qr/can't find/,
        },
-
        {
                name    => 'load include files',
                skip    => 0,
                opts    => {
-                       include_paths => [ qw(
+                       search_dirs => [ qw(
                                templates
                                templates/deeper
                                templates/deeper/deepest
@@ -115,13 +111,15 @@ EXPECTED
                name    => 'delete covering file',
                skip    => 0,
                opts    => {
-                       include_paths => [ qw(
+                       search_dirs => [ qw(
                                templates
                                templates/deeper
                                templates/deeper/deepest
                        ) ],
                },
                pretest => sub { unlink 'templates/deeper/BAR.tmpl' },
+               posttest => sub { write_tmpl_files() },
+
                data    => {},
                expected => <<EXPECTED,
 this loads bar <[this should be hidden then revealed]
@@ -154,6 +152,5 @@ sub write_tmpl_files {
 sub remove_tmpl_files {
 
        unlink keys %tmpl_files ;
-       
        rmdir $_ for reverse @tmpl_dirs ;
 }