Skip Menu |

This queue is for tickets about the Template-Timer CPAN distribution.

Report information
The Basics
Id: 58524
Status: resolved
Priority: 0/
Queue: Template-Timer

People
Owner: Nobody in particular
Requestors: xenoterracide [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Caleb Cushing <xenoterracide [...] gmail.com>
Subject: [PATCH] test eval-ed code
Date: Sat, 19 Jun 2010 00:14:07 -0400
To: bugs-template-timer [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
--- a better test for eval use Template::Test to make code more concise and actually test output. override HiRes sub's to make sure that their output is consistent t/eval.t | 48 ++++++++++++++++++++++++++---------------------- 1 files changed, 26 insertions(+), 22 deletions(-) diff --git a/t/eval.t b/t/eval.t index ee82468..6927397 100644 --- a/t/eval.t +++ b/t/eval.t @@ -1,31 +1,35 @@ -#!perl -Tw - +#!perl use strict; use warnings; +use Template::Timer; +use Template::Test; -use Test::More tests => 3; - -BEGIN { - use_ok( 'Template' ); -} +$Template::Test::DEBUG = 1; -BEGIN { - use_ok( 'Template::Timer' ); -} +my $tt = Template->new({ + CONTEXT => Template::Timer->new, +}); -my $tt = - Template->new( { - CONTEXT => Template::Timer->new - } ); +my $vars = { + place => 'hat', + fragment => "The cat sat on the [% place %]\n", +}; -my $block = q{[% thing = 'doohickey' %]}; +# fake output for consistent output +sub Time::HiRes::gettimeofday { return 0.000; }; +sub Time::HiRes::tv_interval { return 0.000; }; -TODO: { # See RT # 13225 - local $TODO = 'Problem identified but not fixed'; - my $rc = $tt->process( \*DATA, { block => $block } ); - ok( $rc, 'eval' ); -} +test_expect(\*DATA, $tt, $vars); __DATA__ -[% block | eval %] -[% thing %] +-- test -- +[% fragment | eval -%] +-- expect -- +The cat sat on the hat + +<!-- SUMMARY +L1 0.000 P input text +L2 0.000 P (evaluated block) +L2 0.000 0.000 P (evaluated block) +L1 0.000 0.000 P input text +--> -- 1.7.1
Fixed in 1.01_01 by #58523.