fixes due to new Mojo::Renderer error handling, tests

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
This commit is contained in:
vti
2008-11-11 23:53:28 -08:00
committed by Ask Bjørn Hansen
parent 9dce1eb021
commit 68783f08e2
5 changed files with 35 additions and 7 deletions
+5
View File
@@ -1,5 +1,10 @@
Revision history for MojoX-Renderer-TT
0.03
- Add real tests (Viacheslav Tikhanovskii)
- Update to work with new error handling in Mojo
(Viacheslav Tikhanovskii)
0.02 November 10, 2008
- Add template_options parameter
- Fix Template dependency
+5 -7
View File
@@ -44,20 +44,18 @@ sub _init {
}
sub _render {
my ($self, $mojo, $tx, $path, $args) = @_;
my ($self, $mojo, $path, $output, $tx, $args) = @_;
$args ||= {};
#use Data::Dump qw(dump);
#warn dump(\$args);
my $output;
unless ($self->tt->process($path, {%$args, tx => $tx}, \$output, {binmode => ":utf8"})) {
unless ($self->tt->process($path, {%$args, tx => $tx}, $output, {binmode => ":utf8"})) {
Carp::carp $self->tt->error . "\n";
return $self->tt->error;
}
else {
return $output;
return 0;
} else {
return 1;
}
}
+23
View File
@@ -0,0 +1,23 @@
#!perl
use strict;
use warnings;
use Test::More tests => 5;
use Mojo::Transaction;
use_ok('MojoX::Renderer::TT');
my $mt = MojoX::Renderer::TT->new;
my $output;
my $rv;
$rv = $mt->(undef, 't/render/template.tt2', \$output);
is($rv, 1);
is($output, "4\n");
$rv = $mt->(undef, 't/render/template-error.tt2', \$output);
is($rv, 0);
ok($output);
+1
View File
@@ -0,0 +1 @@
[% = 2 %]
+1
View File
@@ -0,0 +1 @@
[% 2 + 2 %]