Permalink
Browse files

test for and avoid re-used packages in template construction

  • Loading branch information...
rjbs committed Nov 12, 2009
1 parent 2b662dc commit 404959da130bda752e4a979752b9b594e8a2974c
Showing with 17 additions and 8 deletions.
  1. +3 −0 Changes
  2. +1 −1 lib/Email/MIME/Kit/Renderer/Text/Template.pm
  3. +12 −6 t/assemble.t
  4. +1 −1 t/kits/test.mkit/manifest.json
View
@@ -1,5 +1,8 @@
Revision history for {{ $dist->name }}
+0.093160 2009-11-12
+ use fill_this_in instead of fill_in_string to avoid package error
+
0.092921 2009-10-19
catch another class of error
@@ -28,7 +28,7 @@ sub render {
(map {; $_ => ref $args->{$_} ? $args->{$_} : \$args->{$_} } keys %$args),
});
- my $result = Text::Template::fill_in_string(
+ my $result = Text::Template->fill_this_in(
$$input_ref,
%{ $self->{template_args} || {} },
HASH => $hash,
View
@@ -12,11 +12,15 @@ my $kit = Email::MIME::Kit->new({
my $email_1 = $kit->assemble({
name => 'Reticulo Johnson',
game => "eatin' pancakes",
+ postlude => ' OUT!',
});
-like(
- $email_1->body,
- qr{\QReticulo Johnson is my name, eatin' pancakes is my game},
+
+my $body_1 = $email_1->body;
+$body_1 =~ s{[\n\r]*\z}{}g;
+is(
+ $body_1,
+ q{Reticulo Johnson is my name, eatin' pancakes is my game. OUT!},
"template stuff happened",
);
@@ -25,9 +29,11 @@ my $email_2 = $kit->assemble({
game => "nukin' jar cheese",
});
-like(
- $email_2->body,
- qr{\QBryan Allen is my name, nukin' jar cheese is my game},
+my $body_2 = $email_2->body;
+$body_2 =~ s{[\n\r]*\z}{}g;
+is(
+ $body_2,
+ q{Bryan Allen is my name, nukin' jar cheese is my game.},
"template stuff happened",
);
@@ -5,5 +5,5 @@
{ "From": "test@example.com" }
],
"type": "text/plain",
- "body": "{ $name } is my name, { $game } is my game."
+ "body": "{ $name } is my name, { $game } is my game.{ $postlude }"
}

0 comments on commit 404959d

Please sign in to comment.