[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-610-ge8da5d5
Shawn Moore
sartak at bestpractical.com
Fri Aug 27 01:10:14 EDT 2010
The branch, 3.9-trunk has been updated
via e8da5d52e3c75402fa8859d7096422030833cec8 (commit)
from 26d6b82da92a2817e874ff112b76ca787baf60de (commit)
Summary of changes:
lib/RT/Test/Web.pm | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit e8da5d52e3c75402fa8859d7096422030833cec8
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Aug 27 01:12:33 2010 -0400
Add some helper functions for progressively testing warnings
diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index a3fdf0d..37ef90c 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -196,6 +196,26 @@ sub warning_like {
return Test::More::like($warnings[0], $re, $name);
}
+sub next_warning_like {
+ my $self = shift;
+ my $re = shift;
+ my $name = shift;
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ if (@{ $self->{stashed_server_warnings} || [] } == 0) {
+ my @warnings = $self->get_warnings;
+ if (@warnings == 0) {
+ Test::More::fail("no warnings emitted; expected 1");
+ return 0;
+ }
+ $self->{stashed_server_warnings} = \@warnings;
+ }
+
+ my $warning = shift @{ $self->{stashed_server_warnings} };
+ return Test::More::like($warning, $re, $name);
+}
+
sub no_warnings_ok {
my $self = shift;
my $name = shift || "no warnings emitted";
@@ -212,4 +232,21 @@ sub no_warnings_ok {
return @warnings == 0 ? 1 : 0;
}
+sub no_leftover_warnings_ok {
+ my $self = shift;
+
+ my $name = shift || "no leftover warnings";
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my @warnings = @{ $self->{stashed_server_warnings} || [] };
+
+ Test::More::is(@warnings, 0, $name);
+ for (@warnings) {
+ Test::More::diag("leftover warning: $_");
+ }
+
+ return @warnings == 0 ? 1 : 0;
+}
+
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list