[Catalyst-commits] r10483 - in
Catalyst-Devel/1.00/branches/helper_refactor: lib/Catalyst t
dhoss at dev.catalyst.perl.org
dhoss at dev.catalyst.perl.org
Tue Jun 9 08:00:38 GMT 2009
Author: dhoss
Date: 2009-06-09 08:00:37 +0000 (Tue, 09 Jun 2009)
New Revision: 10483
Modified:
Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm
Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t
Log:
tests now pass!
Modified: Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm 2009-06-09 07:20:45 UTC (rev 10482)
+++ Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm 2009-06-09 08:00:37 UTC (rev 10483)
@@ -226,7 +226,7 @@
sub mk_file {
my ( $self, $file, $content ) = @_;
- if ( -e $file ) {
+ if ( -e $file && -s _ ) {
print qq/ exists "$file"\n/;
return 0
unless ( $self->{'.newfiles'}
@@ -277,7 +277,7 @@
sub render_file {
my ( $self, $file, $path, $vars ) = @_;
my $template = $self->get_file( ( caller(0) )[0], $file );
- $self->render_file_contents($self, $template, $path, $vars);
+ $self->render_file_contents($template, $path, $vars);
}
sub render_sharedir_file {
Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t 2009-06-09 07:20:45 UTC (rev 10482)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t 2009-06-09 08:00:37 UTC (rev 10483)
@@ -21,13 +21,20 @@
is $example1, 'foobar[% test_var %]';
is $example2, 'bazquux';
+package MyTestHelper;
+
+use Test::More;
+use File::Temp qw/tempfile/;
+
my ($fh, $fn) = tempfile;
-$helper->render_file($fn, { test_var => 'test_val' });
-seek $fh, 0, 0; # Rewind
+close $fh;
+$helper->render_file('example1', $fn, { test_var => 'test_val' });
+open $fh, $fn or die $@;
+#seek $fh, 0, 0; # Rewind
my $contents;
{
local $/;
$contents = <$fh>;
}
warn $contents;
-is $contents, 'foobartest_val';
+is $contents, "foobartest_val\n";
More information about the Catalyst-commits
mailing list