[libtest-bdd-cucumber-perl] 46/52: JSON::XS -> JSON::MaybeXS and a couple of little tidies

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 8045b30f3c0547175ceaf5a5d8f08bb0a1ce30fb
Author: Peter Sergeant <pete at Peters-MacBook-Air-2.local>
Date:   Sat May 31 17:05:20 2014 +0100

    JSON::XS -> JSON::MaybeXS and a couple of little tidies
---
 dist.ini                          |  4 ++--
 lib/Test/BDD/Cucumber/I18n.pm     |  2 +-
 lib/Test/BDD/Cucumber/StepFile.pm | 29 ++++++++++++++---------------
 t/900_run_cucumber_tests.t        |  2 +-
 4 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/dist.ini b/dist.ini
index 7b92e9b..7639023 100644
--- a/dist.ini
+++ b/dist.ini
@@ -17,6 +17,7 @@ File::Find::Rule = 0
 File::Slurp = 0
 FindBin::libs = 0
 Getopt::Long = 0
+JSON::MaybeXS = 0
 Moose = 0
 Ouch = 0
 Path::Class = 0
@@ -25,5 +26,4 @@ Term::ANSIColor = 3.00
 Test::Builder = 0
 Test::Differences = 0
 Test::More = 0
-YAML::Syck = 0
-JSON::XS = 0
+YAML::Syck = 0
\ No newline at end of file
diff --git a/lib/Test/BDD/Cucumber/I18n.pm b/lib/Test/BDD/Cucumber/I18n.pm
index ab91fe5..281b174 100644
--- a/lib/Test/BDD/Cucumber/I18n.pm
+++ b/lib/Test/BDD/Cucumber/I18n.pm
@@ -30,7 +30,7 @@ use strict;
 use warnings;
 
 use Encode qw(encode);
-use JSON::XS;
+use JSON::MaybeXS;
 use utf8;
 use Ouch;
 use File::ShareDir qw( dist_dir );
diff --git a/lib/Test/BDD/Cucumber/StepFile.pm b/lib/Test/BDD/Cucumber/StepFile.pm
index c00f1f3..d64494a 100755
--- a/lib/Test/BDD/Cucumber/StepFile.pm
+++ b/lib/Test/BDD/Cucumber/StepFile.pm
@@ -67,9 +67,10 @@ these are returned to it...
 
 =cut
 
-sub Given     { push( @definitions, [ Given     => @_ ] ) }
-sub When      { push( @definitions, [ When      => @_ ] ) }
-sub Then      { push( @definitions, [ Then      => @_ ] ) }
+# Mapped to Given, When, and Then as part of the i18n mapping below
+sub _Given     { push( @definitions, [ Given     => @_ ] ) }
+sub _When      { push( @definitions, [ When      => @_ ] ) }
+sub _Then      { push( @definitions, [ Then      => @_ ] ) }
 
 sub Step      { push( @definitions, [ Step      => @_ ] ) }
 
@@ -80,14 +81,11 @@ sub After     { push( @definitions, [ After     => @_ ] ) }
 my @SUBS;
 
 for my $language (languages()) {
-    # skip English since these are the function we alias
-    next if $language eq 'en';
-
     my $langdef=langdef($language);
 
-    _alias_function( $langdef->{given}, \&Given);
-    _alias_function( $langdef->{when}, \&When);
-    _alias_function( $langdef->{then}, \&Then);
+    _alias_function( $langdef->{given}, \&_Given);
+    _alias_function( $langdef->{when},  \&_When);
+    _alias_function( $langdef->{then},  \&_Then);
 
 # Hm ... in cucumber, all step definining keywords are the same.
 # Here, the parser replaces 'and' and 'but' with the last verb. Tricky ...
@@ -107,13 +105,14 @@ sub _alias_function {
 
     my $subname=keyword_to_subname($word);
 
-    no strict 'refs';
-    no warnings 'redefine';
-    *$subname=$f;
-    use warnings 'redefine';
+    {
+      no strict 'refs';
+      no warnings 'redefine';
+      no warnings 'once';
 
-    push @SUBS, $subname;
-    use strict 'refs';
+      *$subname=$f;
+      push @SUBS, $subname;
+    }
   }
 }
 
diff --git a/t/900_run_cucumber_tests.t b/t/900_run_cucumber_tests.t
index 7e5e7f3..10af169 100644
--- a/t/900_run_cucumber_tests.t
+++ b/t/900_run_cucumber_tests.t
@@ -8,7 +8,7 @@ use Test::More;
 
 use Test::File::ShareDir
   -share => {
-    -dist   => { 'Test-BDD-Cucumber'    => 'share' }
+    -dist   => { 'Test-BDD-Cucumber' => 'share' }
   };
 
 use Test::BDD::Cucumber::Loader;

-- 
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