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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Aug 6 14:18:37 EDT 2007


Author: sartak
Date: Mon Aug  6 14:18:36 2007
New Revision: 3811

Modified:
   Test-WWW-Declare/   (props changed)
   Test-WWW-Declare/lib/Test/WWW/Declare.pm
   Test-WWW-Declare/t/01-basic.t
   Test-WWW-Declare/t/02-skip.t
   Test-WWW-Declare/t/03-mech.t
   Test-WWW-Declare/t/04-fail.t
   Test-WWW-Declare/t/05-forms.t
   Test-WWW-Declare/t/06-title.t
   Test-WWW-Declare/t/07-alt-names.t
   Test-WWW-Declare/t/09-multisession.t

Log:
 r29961 at caladan:  sartak | 2007-08-06 14:18:04 -0400
 Sessions are just localizing a mech, so they no longer make tests


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	Mon Aug  6 14:18:36 2007
@@ -13,7 +13,6 @@
                  never always lack lacks);
 our $BUILDER = Test::Builder->new();
 our $WWW_MECHANIZE;
-our $FLOWS_FAILED;
 our %mechs;
 
 =begin private
@@ -264,7 +263,6 @@
         $BUILDER->skip($reason);
     }
     elsif ($@) {
-        $FLOWS_FAILED++;
         $BUILDER->ok(0, $name);
         $BUILDER->diag($@);
     }
@@ -279,27 +277,15 @@
 
     $mechs{$title} ||= Test::WWW::Mechanize->new();
     local $WWW_MECHANIZE = $mechs{$title};
-    local $FLOWS_FAILED = 0;
 
     eval { $coderef->() };
 
-    if ($@ =~/^SKIP: (.*)$/) {
+    if ($@ =~ /^SKIP: (.*)$/) {
         my $reason = $1;
         $BUILDER->skip($reason);
     }
-    elsif ($@ || $FLOWS_FAILED) {
-        $BUILDER->ok(0, $title);
-        if ($@)
-        {
-            $BUILDER->diag($@);
-        }
-        else
-        {
-            $BUILDER->diag("Session '$title' failed because $FLOWS_FAILED of its flows failed");
-        }
-    }
-    else {
-        $BUILDER->ok(1, $title);
+    elsif ($@) {
+        $BUILDER->diag($@);
     }
 }
 

Modified: Test-WWW-Declare/t/01-basic.t
==============================================================================
--- Test-WWW-Declare/t/01-basic.t	(original)
+++ Test-WWW-Declare/t/01-basic.t	Mon Aug  6 14:18:36 2007
@@ -1,5 +1,5 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 7;
+use Test::WWW::Declare::Tester tests => 4;
 use warnings;
 use strict;
 
@@ -17,13 +17,8 @@
 );
 
 shift @results; # Test::Tester gives 1-based arrays
-is(@results, 2, "had two tests");
+is(@results, 1, "had one test");
 ok($results[0]{ok}, "1st test passed");
-ok($results[1]{ok}, "2nd test passed");
-
-is($results[0]{name}, "basic connectivity", "1st test was flow");
-is($results[1]{name}, "check logins", "2nd test was session");
-
+is($results[0]{name}, "basic connectivity", "test name was correct");
 is($results[0]{diag}, '', 'no warnings/errors');
-is($results[1]{diag}, '', 'no warnings/errors');
 

Modified: Test-WWW-Declare/t/02-skip.t
==============================================================================
--- Test-WWW-Declare/t/02-skip.t	(original)
+++ Test-WWW-Declare/t/02-skip.t	Mon Aug  6 14:18:36 2007
@@ -1,15 +1,19 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 11;
+use Test::WWW::Declare::Tester tests => 9;
 use warnings;
 use strict;
 
 my @results = run_tests(
     sub {
         session "check logins" => run {
-            flow "basic connectivity" => check {
+            flow "this will skip" => check {
                 get "http://localhost:$PORT/";
                 SKIP "Just testing skip";
             };
+
+            flow "make sure we don't skip the rest of the flows" => check {
+                title should equal 'INDEX';
+            };
         };
     }
 );
@@ -17,16 +21,13 @@
 shift @results; # Test::Tester gives 1-based arrays
 is(@results, 2, "had two tests");
 ok($results[0]{ok}, "1st test passed");
-ok($results[1]{ok}, "2nd test passed");
+ok($results[1]{ok}, "1st test passed");
 
 is($results[0]{type}, "skip", "type was skip");
 like($results[0]{reason}, qr/^Just testing skip at/, "skip reason was right");
 is($results[0]{name}, "", "skipped test name doesn't appear");
-
-is($results[1]{type}, '', "session's type was empty");
-is($results[1]{skip}, undef, "no skip for session");
-is($results[1]{name}, "check logins", "2nd test was session");
-
 is($results[0]{diag}, '', 'no warnings/errors');
-is($results[1]{diag}, '', 'no warnings/errors');
+
+is($results[1]{name}, "make sure we don't skip the rest of the flows", "correct name for flow");
+is($results[1]{diag}, "", "no warnings/errrors");
 

Modified: Test-WWW-Declare/t/03-mech.t
==============================================================================
--- Test-WWW-Declare/t/03-mech.t	(original)
+++ Test-WWW-Declare/t/03-mech.t	Mon Aug  6 14:18:36 2007
@@ -1,5 +1,5 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 10;
+use Test::WWW::Declare::Tester tests => 7;
 use warnings;
 use strict;
 
@@ -15,16 +15,13 @@
 );
 
 shift @results; # Test::Tester gives 1-based arrays
-is(@results, 3, "had three tests");
+is(@results, 2, "had three tests");
 ok($results[0]{ok}, "1st test passed");
 ok($results[1]{ok}, "2nd test passed");
-ok($results[2]{ok}, "3rd test passed");
 
 is($results[0]{name}, "drop down to mech for checking title", "1st test was by mech");
 is($results[1]{name}, "basic connectivity", "2nd test was flow");
-is($results[2]{name}, "check logins", "2nd test was session");
 
 is($results[0]{diag}, "", "no warnings/errors");
 is($results[1]{diag}, "", "no warnings/errors");
-is($results[2]{diag}, "", "no warnings/errors");
 

Modified: Test-WWW-Declare/t/04-fail.t
==============================================================================
--- Test-WWW-Declare/t/04-fail.t	(original)
+++ Test-WWW-Declare/t/04-fail.t	Mon Aug  6 14:18:36 2007
@@ -1,5 +1,5 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 10;
+use Test::WWW::Declare::Tester tests => 7;
 use warnings;
 use strict;
 
@@ -22,16 +22,13 @@
 );
 
 shift @results; # Test::Tester gives 1-based arrays
-is(@results, 3, "had three tests");
+is(@results, 2, "had two tests");
 ok(!$results[0]{ok}, "1st test failed");
 ok( $results[1]{ok}, "2nd test passed");
-ok(!$results[2]{ok}, "3rd test failed");
 
 is($results[0]{name}, "basic connectivity", "1st test was flow");
 is($results[1]{name}, "should be run", "2nd test was flow");
-is($results[2]{name}, "check logins", "3rd test was session");
 
 like($results[0]{diag}, qr/Content does not match \(?.*?\) at /, "reasonable error message for 'content should match' failing");
 is($results[1]{diag}, '', "no errors/warnings on the second flow");
-like($results[2]{diag}, qr/Session 'check logins' failed because 1 of its flows failed/, "reasonable error message for 'session failed because flow failed'");
 

Modified: Test-WWW-Declare/t/05-forms.t
==============================================================================
--- Test-WWW-Declare/t/05-forms.t	(original)
+++ Test-WWW-Declare/t/05-forms.t	Mon Aug  6 14:18:36 2007
@@ -1,5 +1,5 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 9;
+use Test::WWW::Declare::Tester tests => 7;
 use warnings;
 use strict;
 
@@ -34,15 +34,13 @@
 );
 
 shift @results; # Test::Tester gives 1-based arrays
+is(@results, 2, "two tests");
 ok($results[0]{ok}, "1st test passed");
 ok($results[1]{ok}, "2nd test passed");
-ok($results[2]{ok}, "3rd test passed");
 
 is($results[0]{name}, "search1", "1st test was flow");
 is($results[1]{name}, "search2", "2nd test was flow");
-is($results[2]{name}, "check logins", "3rd test was sessions");
 
 is($results[0]{diag}, '', 'no errors/warnings');
 is($results[1]{diag}, '', 'no errors/warnings');
-is($results[2]{diag}, '', 'no errors/warnings');
 

Modified: Test-WWW-Declare/t/06-title.t
==============================================================================
--- Test-WWW-Declare/t/06-title.t	(original)
+++ Test-WWW-Declare/t/06-title.t	Mon Aug  6 14:18:36 2007
@@ -1,5 +1,5 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 7;
+use Test::WWW::Declare::Tester tests => 4;
 use warnings;
 use strict;
 
@@ -23,13 +23,10 @@
 );
 
 shift @results; # Test::Tester gives 1-based arrays
-is(@results, 2, "had two tests");
+is(@results, 1, "had two tests");
 ok($results[0]{ok}, "1st test passed");
-ok($results[1]{ok}, "2nd test passed");
 
 is($results[0]{name}, "basic connectivity", "1st test was flow");
-is($results[1]{name}, "check logins", "2nd test was session");
 
 is($results[0]{diag}, '', 'no errors/warnings');
-is($results[1]{diag}, '', 'no errors/warnings');
 

Modified: Test-WWW-Declare/t/07-alt-names.t
==============================================================================
--- Test-WWW-Declare/t/07-alt-names.t	(original)
+++ Test-WWW-Declare/t/07-alt-names.t	Mon Aug  6 14:18:36 2007
@@ -1,5 +1,5 @@
 #!perl
-use Test::WWW::Declare::Tester tests => 7;
+use Test::WWW::Declare::Tester tests => 4;
 use warnings;
 use strict;
 
@@ -22,13 +22,8 @@
 );
 
 shift @results; # Test::Tester gives 1-based arrays
-is(@results, 2, "had two tests");
-ok($results[0]{ok}, "1st test passed");
-ok($results[1]{ok}, "2nd test passed");
-
+is(@results, 1, "had two tests");
+ok($results[0]{ok}, "test passed");
 is($results[0]{name}, "basic connectivity", "1st test was flow");
-is($results[1]{name}, "check logins", "2nd test was session");
-
 is($results[0]{diag}, '', 'no errors/warnings');
-is($results[1]{diag}, '', 'no errors/warnings');
 

Modified: Test-WWW-Declare/t/09-multisession.t
==============================================================================
--- Test-WWW-Declare/t/09-multisession.t	(original)
+++ Test-WWW-Declare/t/09-multisession.t	Mon Aug  6 14:18:36 2007
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-my @testnames = ('a', 'b', 'visit FORMY', 'c', 'argy mech', 'visit GOOD', 'd', 'f', 'visit FORMY', 'e', 'visit GOOD', 'visit FORMY');
+my @testnames = ('a', 'b', 'c', 'argy mech', 'd', 'f', 'e');
 plan tests => 1 + 3 * @testnames;
 
 my @results = run_tests(


More information about the Jifty-commit mailing list