fixes due to new Mojo::Renderer error handling, tests
Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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);
|
||||
@@ -0,0 +1 @@
|
||||
[% = 2 %]
|
||||
@@ -0,0 +1 @@
|
||||
[% 2 + 2 %]
|
||||
Reference in New Issue
Block a user