[Jifty-commit] r3804 - in Test-WWW-Declare: doc t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Aug 6 12:45:05 EDT 2007


Author: sartak
Date: Mon Aug  6 12:45:05 2007
New Revision: 3804

Added:
   Test-WWW-Declare/t/09-multisession.t
Modified:
   Test-WWW-Declare/   (props changed)
   Test-WWW-Declare/doc/fancy-sessions.t   (props changed)

Log:
 r29947 at caladan:  sartak | 2007-08-06 12:44:55 -0400
 Tests for fancy sessions


Added: Test-WWW-Declare/t/09-multisession.t
==============================================================================
--- (empty file)
+++ Test-WWW-Declare/t/09-multisession.t	Mon Aug  6 12:45:05 2007
@@ -0,0 +1,56 @@
+#!perl
+use Test::WWW::Declare::Tester tests => 23;
+use warnings;
+use strict;
+
+my @results = run_tests(
+    sub {
+        session "visit GOOD" => run {
+            flow "a" => check {
+                get "http://localhost:$PORT/";
+                click href qr{good};
+                title should equal 'GOOD';
+            };
+
+            session "visit FORMY" => run {
+                flow "b" => check {
+                    get "http://localhost:$PORT/formy";
+                    title should equal 'FORMY';
+                };
+            };
+
+            flow "c" => check {
+                title should equal 'GOOD';
+            };
+        };
+
+        session "visit FORMY" => run {
+            flow "d" => check {
+                title should equal 'FORMY';
+            };
+
+            session "visit GOOD" => run {
+                flow "e" => check {
+                    title should equal 'GOOD';
+
+                    session "visit FORMY" => run {
+                        flow "f" => check {
+                            title should equal 'FORMY';
+                        };
+                    };
+                };
+            };
+        };
+    }
+);
+
+shift @results; # Test::Tester gives 1-based arrays
+is(@results, 11, "had eleven tests");
+for (0..10) { ok($results[$_]{ok}, "test $_ passed") }
+
+my @testnames = ('a', 'b', 'visit FORMY', 'c', 'visit GOOD', 'd', 'f', 'visit FORMY', 'e', 'visit GOOD', 'visit FORMY');
+
+for (1.. at testnames)
+{
+    is($results[$_-1]{name}, $testnames[$_-1], "correct test name for test $_");
+}


More information about the Jifty-commit mailing list