[Jifty-commit] r3773 - in Test-WWW-Declare: lib/Test/WWW

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Aug 3 15:41:34 EDT 2007


Author: sartak
Date: Fri Aug  3 15:41:34 2007
New Revision: 3773

Modified:
   Test-WWW-Declare/   (props changed)
   Test-WWW-Declare/lib/Test/WWW/Declare.pm

Log:
 r29870 at caladan:  sartak | 2007-08-03 15:41:01 -0400
 croak, don't die.
 little fixes elsewhere


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 15:41:34 2007
@@ -81,7 +81,7 @@
     }
     else {
         if (ref $link ne 'Regexp') {
-            die "click doesn't know what to do with a link type of "
+            Carp::croak "click doesn't know what to do with a link type of "
               . ref($link);
         }
         return follow_link(text_regex => $link);
@@ -92,7 +92,7 @@
     my $ret = mech()->follow_link(@_);
 
     if (!$ret) {
-        die "follow_link couldn't find a link matching "
+        Carp::croak "follow_link couldn't find a link matching "
           . "(" . join(', ', @_) . ")"
           . " in: " . mech()->content;
     }
@@ -107,7 +107,7 @@
     $failure = 0 if  $positive && mech()->content =~ $regex;
     $failure = 0 if !$positive && mech()->content !~ $regex;
 
-    die "Content did not match $regex" if $failure;
+    Carp::croak "Content did not match $regex" if $failure;
 }
 
 sub form ($$) {
@@ -121,7 +121,7 @@
 sub fill {
     my $data = shift;
 
-    die "fill expects a hashref" if ref($data) ne 'HASH';
+    Carp::croak "fill expects a hashref" if ref($data) ne 'HASH';
 
     mech()->set_fields(%{$data});
 }
@@ -130,11 +130,11 @@
 sub SKIP ($) {
     my $reason = shift;
 
-    die "SKIP: $reason";
+    Carp::croak "SKIP: $reason";
 }
 
 sub flow ($$) {
-    my $definition = shift;
+    my $name = shift;
     my $coderef = shift;
 
     eval { $coderef->() };
@@ -144,11 +144,11 @@
         $BUILDER->skip($reason);
     }
     elsif ($@) {
-        $BUILDER->ok(0, $definition. ": ". $@);
-        die $@;
+        $BUILDER->ok(0, $name);
+        Carp::croak $@;
     }
     else {
-        $BUILDER->ok(1, $definition);
+        $BUILDER->ok(1, $name);
     }
 }
 
@@ -164,6 +164,7 @@
         $BUILDER->skip($reason);
     }
     elsif ($@) {
+        $BUILDER->diag($@);
         $BUILDER->ok(0, $title);
     }
     else {


More information about the Jifty-commit mailing list