[libtest-bdd-cucumber-perl] 43/52: Removed all traces of Method::Signatures

Intrigeri intrigeri at moszumanska.debian.org
Thu Jun 19 10:18:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 0.19
in repository libtest-bdd-cucumber-perl.

commit 8e7a39bd3707a631303e35a0c16d9271d79a9f13
Author: Peter Sergeant <pete at Peters-MacBook-Air-2.local>
Date:   Sat May 31 15:49:39 2014 +0100

    Removed all traces of Method::Signatures
---
 CHANGES                                            |   2 +-
 .../features/step_definitions/calculator_steps.pl  |  56 +++++-----
 .../features/step_definitions/basic_steps.pl       |  19 ++--
 lib/Test/BDD/Cucumber/Manual/Steps.pod             |   6 +-
 lib/Test/BDD/Cucumber/Manual/Tutorial.pod          |   1 -
 lib/Test/BDD/Cucumber/StepFile.pm                  |  17 ++-
 .../step_definitions/core_steps.pl                 | 115 ++++++++++-----------
 .../step_definitions/tag_steps.pl                  |  35 +++----
 .../010_greedy_table_parsing/test_steps.pl         |  15 ++-
 9 files changed, 129 insertions(+), 137 deletions(-)

diff --git a/CHANGES b/CHANGES
index 3f1eb38..81366b4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,6 @@
 -----
 0.19: 24 Apr 2014
-    - Removed Method::Signatures dependency
+    - Removed all mentions of Method::Signatures
     - Added C and S step file shortcut subrefs
 0.18: 06 Apr 2014
     - Removed Find::File dependency in StepFile.pm
diff --git a/examples/calculator/features/step_definitions/calculator_steps.pl b/examples/calculator/features/step_definitions/calculator_steps.pl
index c672fdd..e3df870 100755
--- a/examples/calculator/features/step_definitions/calculator_steps.pl
+++ b/examples/calculator/features/step_definitions/calculator_steps.pl
@@ -5,15 +5,15 @@ use warnings;
 
 use Test::More;
 use Test::BDD::Cucumber::StepFile;
-use Method::Signatures;
 
 use lib 'examples/calculator/lib/';
 
-Before func( $c ) {
+Before sub {
     use_ok( 'Calculator' );
 };
 
-After func( $c ) {
+After sub {
+    my $c = shift;
     # a bit contrived, as garbage collection would clear it out
     delete $c->stash->{'scenario'}->{'Calculator'};
     ok( not exists $c->stash->{'scenario'}->{'Calculator'} );
@@ -32,36 +32,38 @@ sub map_word_to_number
 
     ok( $word );
     ok( exists $numbers_as_words{ $word } );
-    
+
     return $numbers_as_words{ $word };
 }
 
-Transform qr/^(__THE_NUMBER_\w+__)$/, func( $c ) { map_word_to_number( $1 ) };
+Transform qr/^(__THE_NUMBER_\w+__)$/, sub { map_word_to_number( $1 ) };
 
-Transform qr/^table:number as word$/, func( $c, $data ) {
-    for my $row ( @{ $data } )
-    {
+Transform qr/^table:number as word$/, sub {
+    my ( $c, $data ) = @_;
+
+    for my $row ( @{ $data } ) {
         $row->{'number'} = map_word_to_number( $row->{'number as word'} );
     }
 };
 
-Given 'a new Calculator object', func ($c) {
-    $c->stash->{'scenario'}->{'Calculator'} = Calculator->new() };
+Given 'a new Calculator object', sub {
+    S->{'Calculator'} = Calculator->new()
+};
 
-Given qr/^having pressed (.+)/, func($c) {
-    $c->stash->{'scenario'}->{'Calculator'}->press( $_ ) for split(/(,| and) /, $1);
+Given qr/^having pressed (.+)/, sub {
+    S->{'Calculator'}->press( $_ ) for split(/(,| and) /, $1);
 };
 
-Given qr/^having keyed (.+)/, func($c) {
+Given qr/^having keyed (.+)/, sub {
     # Make this call the having pressed
-    my ( $value ) = @{ $c->matches };
-    $c->stash->{'scenario'}->{'Calculator'}->key_in( $value );
+    my ( $value ) = @{ C->matches };
+    S->{'Calculator'}->key_in( $value );
 };
 
-Given 'having successfully performed the following calculations', func ($c) {
-    my $calculator = $c->stash->{'scenario'}->{'Calculator'};
+Given 'having successfully performed the following calculations', sub {
+    my $calculator = S->{'Calculator'};
 
-    for my $row ( @{ $c->data } ) {
+    for my $row ( @{ C->data } ) {
         $calculator->key_in( $row->{'first'}    );
         $calculator->key_in( $row->{'operator'} );
         $calculator->key_in( $row->{'second'}   );
@@ -73,20 +75,20 @@ Given 'having successfully performed the following calculations', func ($c) {
     }
 };
 
-Given 'having entered the following sequence', func ($c) {
-    $c->stash->{'scenario'}->{'Calculator'}->key_in( $c->data );
+Given 'having entered the following sequence', sub {
+    S->{'Calculator'}->key_in( C->data );
 };
 
-Given 'having added these numbers', func ($c) {
-    for my $row ( @{ $c->data } )
+Given 'having added these numbers', sub {
+    for my $row ( @{ C->data } )
     {
-        $c->stash->{'scenario'}->{'Calculator'}->key_in( $row->{number} );
-        $c->stash->{'scenario'}->{'Calculator'}->key_in( '+' );
+        S->{'Calculator'}->key_in( $row->{number} );
+        S->{'Calculator'}->key_in( '+' );
     }
 };
 
-Then qr/^the display should show (.+)/, func($c) {
-    my ( $value ) = @{ $c->matches };
-    is( $c->stash->{'scenario'}->{'Calculator'}->display, $value,
+Then qr/^the display should show (.+)/, sub {
+    my ( $value ) = @{ C->matches };
+    is( S->{'Calculator'}->display, $value,
         "Calculator display as expected" );
 };
diff --git a/examples/tagged-digest/features/step_definitions/basic_steps.pl b/examples/tagged-digest/features/step_definitions/basic_steps.pl
index 432f157..64f1589 100755
--- a/examples/tagged-digest/features/step_definitions/basic_steps.pl
+++ b/examples/tagged-digest/features/step_definitions/basic_steps.pl
@@ -6,25 +6,24 @@ use warnings;
 use Digest;
 use Test::More;
 use Test::BDD::Cucumber::StepFile;
-use Method::Signatures;
 
-Given qr/a usable "(\w+)" class/, func ($c) { use_ok( $1 ); };
-Given qr/a Digest (\S+) object/, func ($c) {
+Given qr/a usable "(\w+)" class/, sub { use_ok( $1 ); };
+Given qr/a Digest (\S+) object/, sub {
     my $object = Digest->new($1);
     ok( $object, "Object created" );
-    $c->stash->{'scenario'}->{'object'} = $object;
+    S->{'object'} = $object;
 };
 
-When qr/I've added "(.+)" to the object/, func ($c) {
-    $c->stash->{'scenario'}->{'object'}->add( $1 );
+When qr/I've added "(.+)" to the object/, sub {
+    S->{'object'}->add( $1 );
 };
 
-When "I've added the following to the object", func ($c) {
-    $c->stash->{'scenario'}->{'object'}->add( $c->data );
+When "I've added the following to the object", sub {
+    S->{'object'}->add( C->data );
 };
 
-Then qr/the (.+) output is "(.+)"/, func ($c) {
+Then qr/the (.+) output is "(.+)"/, sub {
     my $method = {base64 => 'b64digest', 'hex' => 'hexdigest' }->{ $1 } ||
         do { fail("Unknown output type $1"); return };
-    is( $c->stash->{'scenario'}->{'object'}->$method, $2 );
+    is( S->{'object'}->$method, $2 );
 };
diff --git a/lib/Test/BDD/Cucumber/Manual/Steps.pod b/lib/Test/BDD/Cucumber/Manual/Steps.pod
index 7fb89e4..0dc4105 100644
--- a/lib/Test/BDD/Cucumber/Manual/Steps.pod
+++ b/lib/Test/BDD/Cucumber/Manual/Steps.pod
@@ -21,7 +21,6 @@ Most of your step files will want to start something like:
 
  use Test::More;
  use Test::BDD::Cucumber::StepFile;
- use Method::Signatures;
 
 The fake shebang line gives some hints to syntax highlighters, and
 C<use strict;> and C<use warnings;> are hopefully fairly standard at this point.
@@ -36,9 +35,6 @@ C<Then()> and C<Step()>. These pass the step definitions to the class loading
 the step definitions, and specify which Step Verb should be used - C<Step()>
 matches any.
 
-L<Method::Signatures> allows us to use a small amount of syntactic sugar for the
-step definitions, and gives us the C<func()> keyword you'll see in a minute.
-
 =head1 STEP DEFINITIONS
 
  Given qr/I have (\d+)/, sub {
@@ -50,7 +46,7 @@ step definitions, and gives us the C<func()> keyword you'll see in a minute.
         int( S->{'count'} );
  }
 
- Then qr/The count should be (\d+)/, func ($c) {
+ Then qr/The count should be (\d+)/, sub {
     is( S->{'count'}, C->matches->[0], "Count matches" );
  }
 
diff --git a/lib/Test/BDD/Cucumber/Manual/Tutorial.pod b/lib/Test/BDD/Cucumber/Manual/Tutorial.pod
index 24761c3..8e79387 100644
--- a/lib/Test/BDD/Cucumber/Manual/Tutorial.pod
+++ b/lib/Test/BDD/Cucumber/Manual/Tutorial.pod
@@ -63,7 +63,6 @@ C<features/step_definitions/basic_steps.pl> file in it:
 
  use Test::More;
  use Test::BDD::Cucumber::StepFile;
- use Method::Signatures;
 
  Given qr/a usable (\S+) class/, sub { use_ok( $1 ); };
  Given qr/a Digest (\S+) object/, sub {
diff --git a/lib/Test/BDD/Cucumber/StepFile.pm b/lib/Test/BDD/Cucumber/StepFile.pm
index 5cdb46b..d809dd6 100755
--- a/lib/Test/BDD/Cucumber/StepFile.pm
+++ b/lib/Test/BDD/Cucumber/StepFile.pm
@@ -30,15 +30,14 @@ Defining steps:
  use strict; use warnings; use Test::More;
 
  use Test::BDD::Cucumber::StepFile;
- use Method::Signatures; # Allows short-hand func method
-
- Given     'something',          func ($c) { print "YEAH!" }
- When      qr/smooooth (\d+)/,   func ($c) { print "YEEEHAH $1" }
- Then      qr/something (else)/, func ($c) { print "Meh $1" }
- Step      qr/die now/,          func ($c) { die "now" }
- Transform qr/^(\d+)$/,          func ($c) { int $1 }
- Before                          func ($c) { setup_db() }
- After                           func ($c) { teardown() }
+
+ Given     'something',          sub { print "YEAH!" }
+ When      qr/smooooth (\d+)/,   sub { print "YEEEHAH $1" }
+ Then      qr/something (else)/, sub { S->{'match'} = $1 }
+ Step      qr/die now/,          sub { die "now" }
+ Transform qr/^(\d+)$/,          sub { int $1 }
+ Before                          sub { setup_db() }
+ After                           sub { teardown() }
 
 Loading steps, in a different file:
 
diff --git a/t/cucumber_core_features/step_definitions/core_steps.pl b/t/cucumber_core_features/step_definitions/core_steps.pl
index d7b9c72..2ce645b 100755
--- a/t/cucumber_core_features/step_definitions/core_steps.pl
+++ b/t/cucumber_core_features/step_definitions/core_steps.pl
@@ -8,7 +8,6 @@ use Test::BDD::Cucumber::Harness::Data;
 use Test::BDD::Cucumber::Executor;
 use Test::BDD::Cucumber::Parser;
 use Test::BDD::Cucumber::StepFile;
-use Method::Signatures;
 use List::Util qw/sum/;
 
 my $template = join '', (<DATA>);
@@ -19,114 +18,114 @@ my $step_mappings = {
 	pending => sub { TODO: { local $TODO = 'Todo Step'; ok(0, "Todo Step") } }
 };
 
-Given 'the following feature', func ($c) {
+Given 'the following feature', sub {
 	# Save a new executor
-	$c->stash->{'scenario'}->{'executor'} = Test::BDD::Cucumber::Executor->new();
+	S->{'executor'} = Test::BDD::Cucumber::Executor->new();
 
 	# Create a feature object
-	$c->stash->{'scenario'}->{'feature'} =
-		Test::BDD::Cucumber::Parser->parse_string( $c->data );
+	S->{'feature'} =
+		Test::BDD::Cucumber::Parser->parse_string( C->data );
 };
 
-Given qr/a scenario ("([^"]+)" )?with:/, func ($c) {
+Given qr/a scenario ("([^"]+)" )?with:/, sub {
 	my $scenario_name = $1 || '';
 
 	# Save a new executor
-	$c->stash->{'scenario'}->{'executor'} = Test::BDD::Cucumber::Executor->new();
+	S->{'executor'} = Test::BDD::Cucumber::Executor->new();
 
 	# Create a feature object with just that scenario inside it
-	$c->stash->{'scenario'}->{'feature'} =
+	S->{'feature'} =
 		Test::BDD::Cucumber::Parser->parse_string(
-			$template . "\n\nScenario: $scenario_name\n" . $c->data
+			$template . "\n\nScenario: $scenario_name\n" . C->data
 		);
 };
 
-Given qr/the step "([^"]+)" has a (passing|failing|pending) mapping/, func ($c) {
+Given qr/the step "([^"]+)" has a (passing|failing|pending) mapping/, sub {
 	# Add the step to our 'Step' list in the executor
-	$c->stash->{'scenario'}->{'executor'}->add_steps(
+	S->{'executor'}->add_steps(
 		[ 'Step', $1, $step_mappings->{$2} ]
 	);
 };
 
-When 'Cucumber runs the feature', func ($c) {
-	$c->stash->{'scenario'}->{'harness'} =
+When 'Cucumber runs the feature', sub {
+	S->{'harness'} =
 		Test::BDD::Cucumber::Harness::Data->new({});
 
-	$c->stash->{'scenario'}->{'executor'}->execute(
-		$c->stash->{'scenario'}->{'feature'},
-		$c->stash->{'scenario'}->{'harness'}
+	S->{'executor'}->execute(
+		S->{'feature'},
+		S->{'harness'}
 	);
 };
 
-When 'Cucumber runs the scenario with steps for a calculator', func ($c) {
+When 'Cucumber runs the scenario with steps for a calculator', sub {
 	# FFS. "runs the scenario with steps for a calculator"?!. Cads. Lucky we're
 	# using Perl here...
-	$c->stash->{'scenario'}->{'executor'}->add_steps(
-		[ 'Given', 'a calculator', func ($cc) {
-			$cc->stash->{'scenario'}->{'calculator'} = 0;
-			$cc->stash->{'scenario'}->{'constants'}->{'PI'} = 3.14159265;
+	S->{'executor'}->add_steps(
+		[ 'Given', 'a calculator', sub {
+			S->{'calculator'} = 0;
+			S->{'constants'}->{'PI'} = 3.14159265;
 		} ],
-		[ 'When', 'the calculator computes PI', func ($cc) {
-			$cc->stash->{'scenario'}->{'calculator'} =
-				$cc->stash->{'scenario'}->{'constants'}->{'PI'};
+		[ 'When', 'the calculator computes PI', sub {
+			S->{'calculator'} =
+				S->{'constants'}->{'PI'};
 		} ],
-		[ 'Then', qr/the calculator returns "?(PI|[\d\.]+)"?/, func ($cc) {
-			my $value = $cc->stash->{'scenario'}->{'constants'}->{$1} || $1;
-			is( $cc->stash->{'scenario'}->{'calculator'}, $value,
+		[ 'Then', qr/the calculator returns "?(PI|[\d\.]+)"?/, sub {
+			my $value = S->{'constants'}->{$1} || $1;
+			is( S->{'calculator'}, $value,
 				"Correctly returned $value" );
 		}],
-		[ 'Then', qr/the calculator does not return "?(PI|[\d\.]+)"?/, func ($cc) {
-			my $value = $cc->stash->{'scenario'}->{'constants'}->{$1} || $1;
-			isnt( $cc->stash->{'scenario'}->{'calculator'}, $value,
+		[ 'Then', qr/the calculator does not return "?(PI|[\d\.]+)"?/, sub {
+			my $value = S->{'constants'}->{$1} || $1;
+			isnt( S->{'calculator'}, $value,
 				"Correctly did not return $value" );
 		}],
-		[ 'When', qr/the calculator adds up (.+)/, func ($cc) {
+		[ 'When', qr/the calculator adds up (.+)/, sub {
 			my $numbers = $1;
 			my @numbers = $numbers =~ m/([\d\.]+)/g;
 
-			$cc->stash->{'scenario'}->{'calculator'} = sum( @numbers );
+			S->{'calculator'} = sum( @numbers );
 		}]
 	);
 
-	$c->stash->{'scenario'}->{'harness'} =
+	S->{'harness'} =
 		Test::BDD::Cucumber::Harness::Data->new({});
 
-	$c->stash->{'scenario'}->{'executor'}->execute_scenario({
-		scenario => $c->stash->{'scenario'}->{'feature'}->scenarios->[0],
-		feature  => $c->stash->{'scenario'}->{'feature'},
+	S->{'executor'}->execute_scenario({
+		scenario => S->{'feature'}->scenarios->[0],
+		feature  => S->{'feature'},
 		feature_stash => {},
-		harness => $c->stash->{'scenario'}->{'harness'}
+		harness => S->{'harness'}
 	});
-	$c->stash->{'scenario'}->{'scenario'} =
-		$c->stash->{'scenario'}->{'harness'}->current_feature->{'scenarios'}->[0];
+	S->{'scenario'} =
+		S->{'harness'}->current_feature->{'scenarios'}->[0];
 };
 
-When qr/Cucumber executes the scenario( "([^"]+)")?/, func ($c) {
-	$c->stash->{'scenario'}->{'harness'} =
+When qr/Cucumber executes the scenario( "([^"]+)")?/, sub {
+	S->{'harness'} =
 		Test::BDD::Cucumber::Harness::Data->new({});
 
-	$c->stash->{'scenario'}->{'executor'}->execute_scenario({
-		scenario => $c->stash->{'scenario'}->{'feature'}->scenarios->[0],
-		feature  => $c->stash->{'scenario'}->{'feature'},
+	S->{'executor'}->execute_scenario({
+		scenario => S->{'feature'}->scenarios->[0],
+		feature  => S->{'feature'},
 		feature_stash => {},
-		harness => $c->stash->{'scenario'}->{'harness'}
+		harness => S->{'harness'}
 	});
-	$c->stash->{'scenario'}->{'scenario'} =
-		$c->stash->{'scenario'}->{'harness'}->current_feature->{'scenarios'}->[0];
+	S->{'scenario'} =
+		S->{'harness'}->current_feature->{'scenarios'}->[0];
 };
 
-Then 'the feature passes', func ($c) {
-	my $harness = $c->stash->{'scenario'}->{'harness'};
+Then 'the feature passes', sub {
+	my $harness = S->{'harness'};
 	my $result = $harness->feature_status( $harness->current_feature );
 
 	is( $result->result, 'passing', "Feature passes" ) ||
 		diag( $result->output );
 };
 
-Then qr/the scenario (passes|fails)/, func ($c) {
+Then qr/the scenario (passes|fails)/, sub {
 	my $wanted   = $1;
-	my $harness  = $c->stash->{'scenario'}->{'harness'};
-	my $scenario = $c->stash->{'scenario'}->{'scenario'};
+	my $harness  = S->{'harness'};
+	my $scenario = S->{'scenario'};
 
 	my $result = $harness->scenario_status( $scenario );
 
@@ -139,9 +138,9 @@ Then qr/the scenario (passes|fails)/, func ($c) {
 		diag $result->output;
 };
 
-Then qr/the step "(.+)" is skipped/, func ($c) {
-	my $harness  = $c->stash->{'scenario'}->{'harness'};
-	my $scenario = $c->stash->{'scenario'}->{'scenario'};
+Then qr/the step "(.+)" is skipped/, sub {
+	my $harness  = S->{'harness'};
+	my $scenario = S->{'scenario'};
 
 	my $step = $harness->find_scenario_step_by_name( $scenario, $1 );
 	my $result = $harness->step_status( $step );
@@ -150,9 +149,9 @@ Then qr/the step "(.+)" is skipped/, func ($c) {
 		diag $result->output;
 };
 
-Then qr/the scenario is (pending|undefined)/, func ($c) {
-	my $harness  = $c->stash->{'scenario'}->{'harness'};
-	my $scenario = $c->stash->{'scenario'}->{'scenario'};
+Then qr/the scenario is (pending|undefined)/, sub {
+	my $harness  = S->{'harness'};
+	my $scenario = S->{'scenario'};
 	my $expected = $1;
 
 	my $result = $harness->scenario_status( $scenario );
diff --git a/t/cucumber_core_features/step_definitions/tag_steps.pl b/t/cucumber_core_features/step_definitions/tag_steps.pl
index 8be6ca2..58930a1 100644
--- a/t/cucumber_core_features/step_definitions/tag_steps.pl
+++ b/t/cucumber_core_features/step_definitions/tag_steps.pl
@@ -8,15 +8,14 @@ use Test::BDD::Cucumber::StepFile;
 use Test::BDD::Cucumber::Parser;
 use Test::BDD::Cucumber::Model::Scenario;
 use Test::BDD::Cucumber::Model::TagSpec;
-use Method::Signatures;
 
 my %ordinals = qw/0 first 1 second 2 third 3 fourth 4 fifth/;
 
-Given qr/a scenario tagged with (.+)/, func ($c) {
+Given qr/a scenario tagged with (.+)/, sub {
 	my @tags = $1 =~ m/"\@(.+?)"/g;
 
 	# How many scenarios have we created so far?
-	my $count = $c->stash->{'scenario'}->{'count'}++;
+	my $count = S->{'count'}++;
 
 	# Create a new one
 	my $scenario = Test::BDD::Cucumber::Model::Scenario->new({
@@ -25,7 +24,7 @@ Given qr/a scenario tagged with (.+)/, func ($c) {
 	});
 
 	# Add it to our list
-	my $stack = ($c->stash->{'scenario'}->{'scenarios'} ||= []);
+	my $stack = (S->{'scenarios'} ||= []);
 	push( @$stack, $scenario );
 };
 
@@ -35,16 +34,16 @@ Given qr/a scenario tagged with (.+)/, func ($c) {
 
 sub from_tagspec {
 	my ( $c, $expr ) = @_;
-	my @scenarios = @{ $c->stash->{'scenario'}->{'scenarios'} };
+	my @scenarios = @{ S->{'scenarios'} };
 	my @matched = Test::BDD::Cucumber::Model::TagSpec->new({
 		tags => $expr
 	})->filter( @scenarios );
-	$c->stash->{'scenario'}->{'matched'} = \@matched;
+	S->{'matched'} = \@matched;
 }
 
-When qr/^Cucumber executes scenarios (not |)tagged with (both |)"\@([^"]*)"( (and|or|nor) (without |)"\@([^"]*)")?$/, func ($c) {
+When qr/^Cucumber executes scenarios (not |)tagged with (both |)"\@([^"]*)"( (and|or|nor) (without |)"\@([^"]*)")?$/, sub {
 	my ( $not_flag, $both, $tag1, $two_part, $joiner, $negate_2, $tag2 ) =
-		@{ $c->matches };
+		@{ C->matches };
 
 	# Normalize nor to or
 	$joiner = 'or' if $joiner && $joiner eq 'nor';
@@ -62,16 +61,16 @@ When qr/^Cucumber executes scenarios (not |)tagged with (both |)"\@([^"]*)"( (an
 		[ and => [ not => $inner ] ] :
 		[ and => $inner ];
 
-	from_tagspec( $c, $outer );
+	from_tagspec( shift(), $outer );
 };
 
 # Even I, great regex master, wasn't going to tackle this one in the parser
 # above
-When qr/^Cucumber executes scenarios tagged with "\@([a-z]+)" but not with both "\@([a-z]+)" and "\@([a-z]+)"/, func ($c) {
-	from_tagspec( $c, [ and => $1, [ not => [ and => $2, $3 ] ] ] );
+When qr/^Cucumber executes scenarios tagged with "\@([a-z]+)" but not with both "\@([a-z]+)" and "\@([a-z]+)"/, sub {
+	from_tagspec( shift(), [ and => $1, [ not => [ and => $2, $3 ] ] ] );
 };
 
-Then qr/only the (.+) scenario( is|s are) executed/, func ($c) {
+Then qr/only the (.+) scenario( is|s are) executed/, sub {
 	my $demands = $1;
 	my @translates_to;
 
@@ -84,7 +83,7 @@ Then qr/only the (.+) scenario( is|s are) executed/, func ($c) {
 	}
 
 	# Work out which were executed
-	my @executed = map { $_->name } @{ $c->stash->{'scenario'}->{'matched'} };
+	my @executed = map { $_->name } @{ S->{'matched'} };
 
 	is_deeply( \@executed, \@translates_to, "Right scenarios executed" );
 };
@@ -93,7 +92,7 @@ Then qr/only the (.+) scenario( is|s are) executed/, func ($c) {
 # underlying implementation the author wanted. I didn't implement that way, so
 # I'm just going to piggy-back on it, and use the way I've implemented feature
 # tags...
-Given 'a feature tagged with "@foo"', func ($c) {
+Given 'a feature tagged with "@foo"', sub {
 	my $feature = Test::BDD::Cucumber::Parser->parse_string(<<'HEREDOC'
 @foo
 Feature: Name
@@ -101,11 +100,11 @@ Feature: Name
 	  Given bla
 HEREDOC
 	);
-	$c->stash->{'scenario'}->{'scenarios'} = $feature->scenarios;
+	S->{'scenarios'} = $feature->scenarios;
 };
-Given 'a scenario without any tags', func ($c) {1};
-Then 'the scenario is executed', func ($c) {
-	ok( $c->stash->{'scenario'}->{'matched'}->[0],
+Given 'a scenario without any tags', sub {1};
+Then 'the scenario is executed', sub {
+	ok( S->{'matched'}->[0],
 		"Found an executed scenario" );
 }
 
diff --git a/t/regressions/010_greedy_table_parsing/test_steps.pl b/t/regressions/010_greedy_table_parsing/test_steps.pl
index f235a78..19e1e02 100644
--- a/t/regressions/010_greedy_table_parsing/test_steps.pl
+++ b/t/regressions/010_greedy_table_parsing/test_steps.pl
@@ -5,19 +5,18 @@ use warnings;
 use Test::More;
 use Test::BDD::Cucumber::StepFile;
 use Digest::MD5;
-use Method::Signatures;
 
-Given qr/a Digest MD5 object/, func($c) {
-    $c->stash->{scenario}{digest} = Digest::MD5->new;
+Given qr/a Digest MD5 object/, sub {
+    S->{digest} = Digest::MD5->new;
 };
 
-When qr/I add "([^"]+)" to the object/, func($c) {
-    $c->stash->{scenario}{digest}->add($1);
+When qr/I add "([^"]+)" to the object/, sub {
+    S->{digest}->add($1);
 };
 
-Then qr/the results look like/, func($c) {
-	my $data   = $c->data;
-	my $digest = $c->stash->{scenario}{digest};
+Then qr/the results look like/, sub {
+	my $data   = C->data;
+	my $digest = S->{digest};
     foreach my $row (@{$data}) {
 		my $func   = $row->{method};
 		my $expect = $row->{output};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtest-bdd-cucumber-perl.git



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