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 parent
9dce1eb021
commit
68783f08e2
5 files changed
+35
-7
No files matched your search
@@ -1,5 +1,10 @@
|
|||||||
Revision history for MojoX-Renderer-TT
|
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
|
0.02 November 10, 2008
|
||||||
- Add template_options parameter
|
- Add template_options parameter
|
||||||
- Fix Template dependency
|
- Fix Template dependency
|
||||||
|
|||||||
@@ -44,20 +44,18 @@ sub _init {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub _render {
|
sub _render {
|
||||||
my ($self, $mojo, $tx, $path, $args) = @_;
|
my ($self, $mojo, $path, $output, $tx, $args) = @_;
|
||||||
|
|
||||||
$args ||= {};
|
$args ||= {};
|
||||||
|
|
||||||
#use Data::Dump qw(dump);
|
#use Data::Dump qw(dump);
|
||||||
#warn dump(\$args);
|
#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";
|
Carp::carp $self->tt->error . "\n";
|
||||||
return $self->tt->error;
|
return 0;
|
||||||
}
|
} else {
|
||||||
else {
|
return 1;
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+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