[Jifty-commit] r3772 - in Test-WWW-Declare: lib/Test/WWW
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Aug 3 14:04:07 EDT 2007
Author: sartak
Date: Fri Aug 3 14:04:06 2007
New Revision: 3772
Modified:
Test-WWW-Declare/ (props changed)
Test-WWW-Declare/lib/Test/WWW/Declare.pm
Log:
r29868 at caladan: sartak | 2007-08-03 14:03:56 -0400
Add a "shouldnt" for content shouldnt match qr/foo/
Modified: Test-WWW-Declare/lib/Test/WWW/Declare.pm
==============================================================================
--- Test-WWW-Declare/lib/Test/WWW/Declare.pm (original)
+++ Test-WWW-Declare/lib/Test/WWW/Declare.pm Fri Aug 3 14:04:06 2007
@@ -8,7 +8,7 @@
our $VERSION = '0.00';
our @EXPORT = qw(flow run get session check mech match follow link content
- should click href button fill form SKIP);
+ should shouldnt click href button fill form SKIP);
our $BUILDER = Test::Builder->new();
our $WWW_MECHANIZE;
@@ -30,7 +30,11 @@
# DSLey functions
sub should ($) {
- return shift;
+ return [shift, 1];
+}
+
+sub shouldnt ($) {
+ return [shift, 0];
}
sub match ($) {
@@ -95,11 +99,15 @@
}
sub content ($) {
- my $regex = shift;
+ my $regex_wrapped = shift;
+ my ($regex, $positive) = @$regex_wrapped;
- if (mech()->content !~ /$regex/) {
- die "Content did not match $regex";
- }
+ my $failure = 1;
+
+ $failure = 0 if $positive && mech()->content =~ $regex;
+ $failure = 0 if !$positive && mech()->content !~ $regex;
+
+ die "Content did not match $regex" if $failure;
}
sub form ($$) {
More information about the Jifty-commit
mailing list