r54246 - in /trunk/libtest-cukes-perl: Changes MANIFEST Makefile.PL debian/changelog debian/control debian/copyright debian/libtest-cukes-perl.examples examples/ lib/Test/Cukes.pm t/runtest-with-arg.t t/runtest-without-defined-steps.t t/runtest.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Mar 13 20:39:28 UTC 2010


Author: jawnsy-guest
Date: Sat Mar 13 20:39:20 2010
New Revision: 54246

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54246
Log:
* New upstream release
* Standards-Version 3.8.4 (no changes)
* Add myself to Uploaders and Copyright
* Depend on Test::Simple 0.92 for Test::Builder::Module 0.80
* No longer installs examples/
* Rewrite control description
* Update copyright to new DEP5 format

Removed:
    trunk/libtest-cukes-perl/debian/libtest-cukes-perl.examples
    trunk/libtest-cukes-perl/examples/
Modified:
    trunk/libtest-cukes-perl/Changes
    trunk/libtest-cukes-perl/MANIFEST
    trunk/libtest-cukes-perl/Makefile.PL
    trunk/libtest-cukes-perl/debian/changelog
    trunk/libtest-cukes-perl/debian/control
    trunk/libtest-cukes-perl/debian/copyright
    trunk/libtest-cukes-perl/lib/Test/Cukes.pm
    trunk/libtest-cukes-perl/t/runtest-with-arg.t
    trunk/libtest-cukes-perl/t/runtest-without-defined-steps.t
    trunk/libtest-cukes-perl/t/runtest.t

Modified: trunk/libtest-cukes-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/Changes?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/Changes (original)
+++ trunk/libtest-cukes-perl/Changes Sat Mar 13 20:39:20 2010
@@ -1,4 +1,7 @@
 # Revision history for Perl extension Test::Cukes
+
+0.09:
+- Tristan Pratt makes it more compatible when using it with other Test::Bulder::Module-based tools.
 
 0.08:
 - allow step definitions to be defined in all namespaces.

Modified: trunk/libtest-cukes-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/MANIFEST?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/MANIFEST (original)
+++ trunk/libtest-cukes-perl/MANIFEST Sat Mar 13 20:39:20 2010
@@ -1,5 +1,4 @@
 Changes
-examples/test.pl
 inc/Module/Install.pm
 inc/Module/Install/AuthorTests.pm
 inc/Module/Install/Base.pm

Modified: trunk/libtest-cukes-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/Makefile.PL?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/Makefile.PL (original)
+++ trunk/libtest-cukes-perl/Makefile.PL Sat Mar 13 20:39:20 2010
@@ -1,13 +1,13 @@
 use inc::Module::Install;
+
 name 'Test-Cukes';
+perl_version '5.008';
 all_from 'lib/Test/Cukes.pm';
 
-perl_version '5.008';
-
 requires
-    "Carp::Assert"       => "0.20",
-    "Any::Moose"           => "0.07",
-    "Exporter::Lite"       => "0.02";
+    "Carp::Assert"           => "0.20",
+    "Any::Moose"             => "0.07",
+    "Test::Builder::Module"  => "0.80";
 
 tests 't/*.t';
 author_tests 'xt';

Modified: trunk/libtest-cukes-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/debian/changelog?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/debian/changelog (original)
+++ trunk/libtest-cukes-perl/debian/changelog Sat Mar 13 20:39:20 2010
@@ -1,3 +1,15 @@
+libtest-cukes-perl (0.09-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Standards-Version 3.8.4 (no changes)
+  * Add myself to Uploaders and Copyright
+  * Depend on Test::Simple 0.92 for Test::Builder::Module 0.80
+  * No longer installs examples/
+  * Rewrite control description
+  * Update copyright to new DEP5 format
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Sat, 13 Mar 2010 16:07:01 -0500
+
 libtest-cukes-perl (0.08-2) unstable; urgency=low
 
   [ Jonathan Yu ]

Modified: trunk/libtest-cukes-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/debian/control?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/debian/control (original)
+++ trunk/libtest-cukes-perl/debian/control Sat Mar 13 20:39:20 2010
@@ -2,25 +2,25 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl, libexporter-lite-perl (>= 0.02),
- libcarp-assert-perl (>= 0.20), libany-moose-perl, libtest-simple-perl (>= 0.82)
+Build-Depends-Indep: perl, perl (>= 5.10.1) | libtest-simple-perl (>= 0.92),
+ libcarp-assert-perl (>= 0.20), libany-moose-perl 
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Christine Spang <christine at debian.org>
-Standards-Version: 3.8.2
+Uploaders: Christine Spang <christine at debian.org>,
+ Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/Test-Cukes/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtest-cukes-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libtest-cukes-perl
 
 Package: libtest-cukes-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends},
-  libexporter-lite-perl (>= 0.02), libcarp-assert-perl (>= 0.20),
-  libany-moose-perl (>= 0.07)
-Description: Perl test tool inspired by Cucumber
- Test::Cukes is a testing tool inspired by Cucumber (http://cukes.info).
- It lets your write your module tests with scenarios. It is supposed to be
- used with Test::More or other family of Test::* modules. It uses
- Test::More::note function internally to print messages.
+Depends: ${perl:Depends}, ${misc:Depends}, libcarp-assert-perl (>= 0.20),
+ libany-moose-perl
+Description: test framework inspired by Cucumber
+ Test::Cukes is a Perl test framework inspired by Cucumber, which lets you
+ write module tests with scenarios and is compatible with Test::More and other
+ TAP-compliant modules. It uses Test::Builder's note function internally to
+ print messages.
  .
- For more info about how to define feature and scenarios, please read the
- documents from http://cukes.info.
+ For more information about how to define features and scenarios, please read
+ the Cucumber documentation from <URL:http://cukes.info/>

Modified: trunk/libtest-cukes-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/debian/copyright?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/debian/copyright (original)
+++ trunk/libtest-cukes-perl/debian/copyright Sat Mar 13 20:39:20 2010
@@ -1,69 +1,71 @@
-Format-Specification:
-    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
-Upstream-Maintainer: Kang-min Liu <gugod at gugod.org>
-Upstream-Source: http://search.cpan.org/dist/Test-Cukes/
-Upstream-Name: Test-Cukes
-
-Files: inc/Module/*
-Copyright: 2002-2009, Adam Kennedy <adamk at cpan.org>
-           2002-2009, Audrey Tang <autrijus at autrijus.org>
-           2002-2009, Brian Ingerson <ingy at cpan.org>
-License-Alias: Perl
-License: Artistic | GPL-1+
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59
+Maintainer: Kang-min Liu <gugod at gugod.org>
+Source: http://search.cpan.org/dist/Test-Cukes/
+Name: Test-Cukes
 
 Files: *
 Copyright: 2009, Kang-min Liu <gugod at gugod.org>
 License: MIT
 
+Files: inc/Module/*
+Copyright: 2002-2010, Adam Kennedy <adamk at cpan.org>
+ 2002-2010, Audrey Tang <autrijus at autrijus.org>
+ 2002-2010, Brian Ingerson <ingy at cpan.org>
+License: Artistic or GPL-1+
+
 Files: debian/*
-Copyright: 2009, Christine Spang <christine at debian.org>
-License: MIT | Artistic | GPL-1+
+Copyright: 2010, Jonathan Yu <jawnsy at cpan.org>
+ 2009, Christine Spang <christine at debian.org>
+License: MIT or Artistic or GPL-1+
 
 License: MIT
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the MIT (X11) license. The full text of this license is:
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy
-    of this software and associated documentation files (the "Software"), to deal
-    in the Software without restriction, including without limitation the rights
-    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-    copies of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-    FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-    OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-    PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
-    EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-    ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
-    YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-    NECESSARY SERVICING, REPAIR, OR CORRECTION.
-
-    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-    WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-    REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
-    LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
-    OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
-    THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-    RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-    FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-    SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-    SUCH DAMAGES.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the MIT (X11) license. The full text of this license is:
+ .
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+ FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+ PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+ EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
+ YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+ NECESSARY SERVICING, REPAIR, OR CORRECTION.
+ .
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+ REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
+ LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
+ OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+ THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+ FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGES.
 
 License: Artistic
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the Artistic License, which comes with Perl.
-    On Debian GNU/Linux systems, the complete text of the Artistic License
-    can be found in `/usr/share/common-licenses/Artistic'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian GNU/Linux systems, the complete text of the Artistic License
+ can be found in `/usr/share/common-licenses/Artistic'
 
 License: GPL-1+
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 1, or (at your option)
-    any later version.
-    On Debian GNU/Linux systems, the complete text of the GNU General
-    Public License can be found in `/usr/share/common-licenses/GPL'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian GNU/Linux systems, the complete text of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL'
+

Modified: trunk/libtest-cukes-perl/lib/Test/Cukes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/lib/Test/Cukes.pm?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/lib/Test/Cukes.pm (original)
+++ trunk/libtest-cukes-perl/lib/Test/Cukes.pm Sat Mar 13 20:39:20 2010
@@ -1,12 +1,12 @@
 package Test::Cukes;
 use strict;
 use warnings;
-use Exporter::Lite;
-use Test::More;
 use Test::Cukes::Feature;
 use Carp::Assert;
 
-our $VERSION = "0.08";
+use base 'Test::Builder::Module';
+
+our $VERSION = "0.09";
 our @EXPORT = qw(feature runtests Given When Then assert affirm should shouldnt);
 
 our @missing_steps = ();
@@ -29,15 +29,7 @@
         $feature->{$caller} = Test::Cukes::Feature->new($feature_text);
     }
 
-    my $total_tests = 0;
-
     my @scenarios_of_caller = @{$feature->{$caller}->scenarios};
-
-    for my $scenario (@scenarios_of_caller) {
-        $total_tests += @{$scenario->steps};
-    }
-
-    Test::More::plan(tests => $total_tests);
 
     for my $scenario (@scenarios_of_caller) {
         my $skip = 0;
@@ -47,7 +39,7 @@
     SKIP:
         for my $step_text (@{$scenario->steps}) {
             my ($pre, $step) = split " ", $step_text, 2;
-            Test::More::skip($step, 1) if $skip;
+            Test::Cukes->skip($step, 1) if $skip;
 
             $gwt = $pre if $pre =~ /(Given|When|Then)/;
 
@@ -55,12 +47,12 @@
             for my $step_pattern (keys %$steps) {
                 my $cb = $steps->{$step_pattern}->{code};
 
-                if ($step =~ m/$step_pattern/) {
-                    eval { $cb->(); };
-                    Test::More::ok(!$@, $step_text);
+                if (my (@matches) = $step =~ m/$step_pattern/) {
+                    eval { $cb->(@matches); };
+                    Test::Cukes->builder->ok(!$@, $step_text);
 
                     if ($@) {
-                        Test::More::diag($@);
+                        Test::Cukes->builder->diag($@);
                         $skip = 1;
                         $skip_reason = "Failed: $step_text";
                     }
@@ -77,6 +69,10 @@
         }
     }
 
+    # If the user doesn't specify tests explicitly when they use Test::Cukes;,
+    # assume they had no plan and call done_testing for them.
+    Test::Cukes->builder->done_testing if !Test::Cukes->builder->has_plan;
+
     report_missing_steps();
 
     return 0;
@@ -84,11 +80,11 @@
 
 sub report_missing_steps {
     return if @missing_steps == 0;
-    Test::More::note("There are missing step definitions, fill them in:");
+    Test::Cukes->builder->note("There are missing step definitions, fill them in:");
     for my $step_text (@missing_steps) {
         my ($word, $text) = ($step_text =~ /^(Given|When|Then) (.+)$/);
         my $msg = "\n$word qr/${text}/ => sub {\n    ...\n};\n";
-        Test::More::note($msg);
+        Test::Cukes->builder->note($msg);
     }
 }
 
@@ -122,8 +118,8 @@
 Write your test program like this:
 
   # test.pl
-  use Test::More;
   use Test::Cukes;
+  # use Test::Cukes tests => 3;
 
   feature(<<TEXT);
   Feature: writing behavior tests
@@ -137,8 +133,9 @@
       Then it should pass
   TEXT
 
-  Given qr/the test program is running/, sub {
-      assert "running";
+  Given qr/the (.+) program is (.+)/, sub {
+      my ($program_name, $running_or_failing) = @_;
+      assert "running program '$program_name'";
   };
 
   When qr/it reaches this step/, sub {
@@ -163,23 +160,31 @@
 
 Test::Cukes is a testing tool inspired by Cucumber
 (L<http://cukes.info>). It lets your write your module test with
-scenarios. It is supposed to be used with L<Test::More> or other
-family of C<Test::*> modules. It uses L<Test::More::note> function
+scenarios. It may be used with L<Test::More> or other family of
+TAP C<Test::*> modules. It uses L<Test::Builder::note> function
 internally to print messages.
 
 This module implements the Given-When-Then clause only in English. To
 uses it in the test programs, feed the feature text into C<feature>
 function, defines your step handlers, and then run all the tests by
-calling C<runtests>. Each steps should use C<assert> instead of C<ok>
-or C<is> to verify desired result.
-
-If any assertion in the Given block failed, the the corresponding
-C<When> and C<Then> blocks are skipped.
+calling C<runtests>. Step handlers may be defined in separate modules,
+as long as those modules are included before C<runtests> is called.
+Each step may use either C<assert> or standard TAP functions such as
+C<Test::Simple>'s C<ok> or C<Test::More>'s C<is> to verify desired
+result.  If you specify a plan explicitly, you should be aware that
+each step line in your scenario runs an additional test, and will
+therefore add to the number of tests you must indicate.
+
+If any assertion in the Given block failed, the following C<When> and
+C<Then> blocks are all skipped.
 
 You don't need to specify the number of tests with C<plan>. Each step
 block itself is simply one test. If the block died, it's then
 considered failed. Otherwise it's considered as passing.
 
+In the call to L<Test::Cukes::runtests>, L<done_testing> will automatically
+be called for you if you didn't specify a plan.
+
 Test::Cukes re-exports C<assert> function from C<Carp::Assert> for you
 to use in the step block.
 
@@ -189,6 +194,10 @@
 =head1 AUTHOR
 
 Kang-min Liu E<lt>gugod at gugod.orgE<gt>
+
+=head1 CONTRIBUTORS
+
+Tatsuhiko Miyagawa, Tristan Pratt
 
 =head1 SEE ALSO
 

Modified: trunk/libtest-cukes-perl/t/runtest-with-arg.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/t/runtest-with-arg.t?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/t/runtest-with-arg.t (original)
+++ trunk/libtest-cukes-perl/t/runtest-with-arg.t Sat Mar 13 20:39:20 2010
@@ -18,7 +18,11 @@
     push @passed, 3;
     assert @passed == 3;
 
-    assert( @{[ 1, 2, 3 ]} == @passed );
+    # We can't use is_deeply because Test::More doesn't play nice with
+    # Cukes's plan.
+    assert 1 == $passed[0];
+    assert 2 == $passed[1];
+    assert 3 == $passed[2];
 };
 
 runtests(<<FEATURE_TEXT);

Modified: trunk/libtest-cukes-perl/t/runtest-without-defined-steps.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/t/runtest-without-defined-steps.t?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/t/runtest-without-defined-steps.t (original)
+++ trunk/libtest-cukes-perl/t/runtest-without-defined-steps.t Sat Mar 13 20:39:20 2010
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl -w
 use strict;
-use Test::Cukes;
 use Test::More;
+use Test::Cukes tests => 2;
 
 feature(<<FEATURE_TEXT);
 Feature: foo
@@ -9,13 +9,18 @@
   I want to bleh
 
   Scenario: blehbleh
-    Given blah1
+    Given I am a missing person
     When blah2
     Then blah3
 FEATURE_TEXT
 
+# This regex shouldn't match.
+my $hit_given = 0;
+When qr/I am a missing (animal|alien)/i => sub {
+  $hit_given = 1;
+};
+
 runtests;
 
+is($hit_given, 0, "Correctly never ran the 'when' test"); 
 ok(@Test::Cukes::missing_steps == 3);
-pass; # two dummise
-pass;

Modified: trunk/libtest-cukes-perl/t/runtest.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-cukes-perl/t/runtest.t?rev=54246&op=diff
==============================================================================
--- trunk/libtest-cukes-perl/t/runtest.t (original)
+++ trunk/libtest-cukes-perl/t/runtest.t Sat Mar 13 20:39:20 2010
@@ -1,6 +1,7 @@
 #!/usr/bin/env perl -w
 use strict;
 use Test::Cukes;
+use Test::More;
 
 feature(<<FEATURE_TEXT);
 Feature: foo
@@ -8,29 +9,42 @@
   I want to bleh
 
   Scenario: blehbleh
-    Given blah1
-    When blah2
-    Then blah3
+    Given I will say the word 'cake'
+    When it is my birthday
+    Then we will eat 28 cakes
 FEATURE_TEXT
 
 my @passed;
+my @regex_matches;
 
-Given qr/blah1/ => sub {
+Given qr/I will say the word '(.+)'/ => sub {
     push @passed, 1;
+    push @regex_matches, @_;
 
-    assert @passed == 1;
+    assert @passed        == 1;
+    assert @regex_matches == 1
 };
 
-When qr/blah2/ => sub {
+When qr/it is my birthday/ => sub {
     push @passed, 2;
-    assert @passed == 2;
+
+    ok 1, "Using is, ok, etc no longer screw up Cuke's test plan and cause"
+      . " it to fail.";
+
+    assert @passed        == 2;
+    assert @regex_matches == 1
 };
 
-Then qr/blah3/ => sub {
+Then qr/we will eat (\d+) (.+)/ => sub {
     push @passed, 3;
-    assert @passed == 3;
+    push @regex_matches, @_;
 
-    assert( @{[ 1, 2, 3 ]} == @passed );
+    assert @passed        == 3;
+    assert @regex_matches == 3;
+
+    is_deeply [1, 2, 3], \@passed, "Steps were called in the correct order";
+    is_deeply ['cake', 28, 'cakes'], \@regex_matches, "Regex matches were"
+      . " correctly passed to the step functions";
 };
 
 runtests;




More information about the Pkg-perl-cvs-commits mailing list