CC: | jason [...] lecstor.com |
Subject: | block not found error persists after block is fixed.. |
sorry guys, I tried to dive into the code but I can't figure it out.
PROCESSing or INCLUDEing a missing block breaks that block for all templates using that block in the same instance of Template::Alloy..
prove -lv t/alloy_bug.t
t/alloy_bug.t ..
ok 1 - use Template::Alloy;
ok 2
# file error - document_title: not found
not ok 3
# Failed test at t/alloy_bug.t line 29.
# file error - document_title: not found (cached)
not ok 4
# Failed test at t/alloy_bug.t line 30.
ok 5
# file error - document_title: not found
not ok 6
# Failed test at t/alloy_bug.t line 34.
# file error - document_title: not found (cached)
not ok 7
1..7
# Failed test at t/alloy_bug.t line 35.
# Looks like you failed 4 tests of 7.
Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/7 subtests
Test Summary Report
-------------------
t/alloy_bug.t (Wstat: 1024 Tests: 7 Failed: 4)
Failed tests: 3-4, 6-7
Non-zero exit status: 4
Files=1, Tests=7, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.05 cusr 0.00 csys = 0.07 CPU)
Result: FAIL
Subject: | alloy_bug.t |
use Test::More;
use strict;
use warnings;
use_ok 'Template::Alloy';
my $t1 = <<"__EOP__";
[% BLOCK document_title %]bling[% END %]
[% INCLUDE document_title %]
__EOP__
my $t2 = <<__EOP__;
[% INCLUDE document_title %]
__EOP__
my $t3 = <<__EOP__;
[% BLOCK document_title %]blah[% END %]
[% PROCESS document_title %]
__EOP__
my $t4 = <<__EOP__;
[% PROCESS document_title %]
__EOP__
my $out;
my $alloy = Template::Alloy->new();
ok $alloy->process(\$t1, {}, \$out) || diag($alloy->error);
ok $alloy->process(\$t2, {}, \$out) || diag($alloy->error);
ok $alloy->process(\$t1, {}, \$out) || diag($alloy->error);
$alloy = Template::Alloy->new();
ok $alloy->process(\$t3, {}, \$out) || diag($alloy->error);
ok $alloy->process(\$t4, {}, \$out) || diag($alloy->error);
ok $alloy->process(\$t3, {}, \$out) || diag($alloy->error);
done_testing();