[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-520-gafb1cfc
Shawn Moore
sartak at bestpractical.com
Tue Aug 24 02:42:26 EDT 2010
The branch, 3.9-trunk has been updated
via afb1cfc6599d7ff4f4a0a9dd14369496b93d0710 (commit)
from cd6b67a9f31eb5a6104853c5e70a1e4a4cb787c9 (commit)
Summary of changes:
t/api/template-simple.t | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit afb1cfc6599d7ff4f4a0a9dd14369496b93d0710
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Aug 24 02:44:49 2010 -0400
Test for the warnings in template-simple
diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index e4efb58..59d5f48 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 196;
+use RT::Test tests => 199;
my $queue = RT::Queue->new($RT::SystemUser);
$queue->Load("General");
@@ -129,12 +129,14 @@ SimpleTemplateTest(
TemplateTest(
Content => "\ntest { \$Ticket->Nonexistent }",
PerlOutput => undef,
+ PerlWarnings => qr/RT::Ticket::Nonexistent Unimplemented/,
SimpleOutput => "test { \$Ticket->Nonexistent }",
);
TemplateTest(
Content => "\ntest { \$Nonexistent->Nonexistent }",
PerlOutput => undef,
+ PerlWarnings => qr/Can't call method "Nonexistent" on an undefined value/,
SimpleOutput => "test { \$Nonexistent->Nonexistent }",
);
@@ -147,6 +149,7 @@ TemplateTest(
TemplateTest(
Content => "\ntest { *!( }",
PerlOutput => undef,
+ PerlWarnings => qr/syntax error/,
SimpleOutput => "test { *!( }",
);
@@ -200,6 +203,11 @@ sub IndividualTemplateTest {
@_,
);
+ my $warnings;
+ local $SIG{__WARN__} = sub {
+ $warnings .= "@_";
+ } if $args{Warnings};
+
my $t = RT::Template->new($RT::SystemUser);
$t->Create(
Name => $args{Name},
@@ -221,7 +229,11 @@ sub IndividualTemplateTest {
is($t->MIMEObj->stringify_body, $args{Output}, "$args{Type} template's output");
}
else {
- ok(!$ok, "expected failure: $msg");
+ ok(!$ok, "expected a failure");
+ }
+
+ if ($args{Warnings}) {
+ like($warnings, $args{Warnings}, "warnings matched");
}
}
@@ -234,8 +246,9 @@ sub TemplateTest {
IndividualTemplateTest(
%args,
- Type => $type,
- Output => $args{$type . 'Output'},
+ Type => $type,
+ Output => $args{$type . 'Output'},
+ Warnings => $args{$type . 'Warnings'},
);
}
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list