summaryrefslogtreecommitdiff
path: root/cpan/autodie
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2012-08-27 08:54:50 +0200
committerYves Orton <demerphq@gmail.com>2012-11-08 08:10:17 +0100
commit91d419acae8f9fecd22ae9054297725fbddda0a2 (patch)
tree3422d2da9af3b2aa567e1982137eaf42e17e7935 /cpan/autodie
parente7eb9d6b8a020c216e2fe51ba09dd7561a729258 (diff)
downloadperl-91d419acae8f9fecd22ae9054297725fbddda0a2.tar.gz
fix a hash key order dependency in cpan/autodie/t/hints_pod_examples.t
At the same time make part of the internals deterministic Just In Case. Version bump on autodie to 2.13 as well.
Diffstat (limited to 'cpan/autodie')
-rw-r--r--cpan/autodie/lib/Fatal.pm7
-rw-r--r--cpan/autodie/lib/autodie.pm2
-rw-r--r--cpan/autodie/lib/autodie/exception.pm2
-rw-r--r--cpan/autodie/lib/autodie/exception/system.pm2
-rw-r--r--cpan/autodie/lib/autodie/hints.pm2
-rw-r--r--cpan/autodie/t/hints_pod_examples.t35
6 files changed, 37 insertions, 13 deletions
diff --git a/cpan/autodie/lib/Fatal.pm b/cpan/autodie/lib/Fatal.pm
index 87d9da495c..ce17af94ec 100644
--- a/cpan/autodie/lib/Fatal.pm
+++ b/cpan/autodie/lib/Fatal.pm
@@ -40,7 +40,7 @@ use constant ERROR_58_HINTS => q{Non-subroutine %s hints for %s are not supporte
use constant MIN_IPC_SYS_SIMPLE_VER => 0.12;
# All the Fatal/autodie modules share the same version number.
-our $VERSION = '2.12';
+our $VERSION = '2.13';
our $Debug ||= 0;
@@ -118,6 +118,7 @@ my %TAGS = (
':2.10' => [qw(:default)],
':2.11' => [qw(:default)],
':2.12' => [qw(:default)],
+ ':2.13' => [qw(:default)],
);
# chmod was only introduced in 2.07
@@ -409,7 +410,9 @@ sub _install_subs {
my $pkg_sym = "${pkg}::";
- while(my ($sub_name, $sub_ref) = each %$subs_to_reinstate) {
+ # It does not hurt to do this in a predictable order, and might help debugging.
+ foreach my $sub_name (sort keys %$subs_to_reinstate) {
+ my $sub_ref= $subs_to_reinstate->{$sub_name};
my $full_path = $pkg_sym.$sub_name;
diff --git a/cpan/autodie/lib/autodie.pm b/cpan/autodie/lib/autodie.pm
index a2360e3d20..71a6a5e761 100644
--- a/cpan/autodie/lib/autodie.pm
+++ b/cpan/autodie/lib/autodie.pm
@@ -8,7 +8,7 @@ our @ISA = qw(Fatal);
our $VERSION;
BEGIN {
- $VERSION = '2.12';
+ $VERSION = '2.13';
}
use constant ERROR_WRONG_FATAL => q{
diff --git a/cpan/autodie/lib/autodie/exception.pm b/cpan/autodie/lib/autodie/exception.pm
index cd06639fdf..45c723d56a 100644
--- a/cpan/autodie/lib/autodie/exception.pm
+++ b/cpan/autodie/lib/autodie/exception.pm
@@ -14,7 +14,7 @@ use overload
use if ($] >= 5.010), overload => '~~' => "matches";
-our $VERSION = '2.12';
+our $VERSION = '2.13';
my $PACKAGE = __PACKAGE__; # Useful to have a scalar for hash keys.
diff --git a/cpan/autodie/lib/autodie/exception/system.pm b/cpan/autodie/lib/autodie/exception/system.pm
index d3047a8cda..0489b61d11 100644
--- a/cpan/autodie/lib/autodie/exception/system.pm
+++ b/cpan/autodie/lib/autodie/exception/system.pm
@@ -5,7 +5,7 @@ use warnings;
use base 'autodie::exception';
use Carp qw(croak);
-our $VERSION = '2.12';
+our $VERSION = '2.13';
my $PACKAGE = __PACKAGE__;
diff --git a/cpan/autodie/lib/autodie/hints.pm b/cpan/autodie/lib/autodie/hints.pm
index 71c8be389c..36715e979d 100644
--- a/cpan/autodie/lib/autodie/hints.pm
+++ b/cpan/autodie/lib/autodie/hints.pm
@@ -5,7 +5,7 @@ use warnings;
use constant PERL58 => ( $] < 5.009 );
-our $VERSION = '2.12';
+our $VERSION = '2.13';
=head1 NAME
diff --git a/cpan/autodie/t/hints_pod_examples.t b/cpan/autodie/t/hints_pod_examples.t
index a3c6f0f553..21a85fd474 100644
--- a/cpan/autodie/t/hints_pod_examples.t
+++ b/cpan/autodie/t/hints_pod_examples.t
@@ -152,22 +152,43 @@ my $perl58_fix = (
);
# Some of the tests provide different hints for scalar or list context
-
-while (my ($test, $exception_expected) = each %scalar_tests) {
- eval "
+# NOTE: these tests are sensitive to order (not sure why) therefore
+# this loop must use a sorted list of keys . Otherwise there is an occasional
+# failure like this:
+#
+# Failed test 'scalar test - zero_scalar("")'
+# at cpan/autodie/t/hints_pod_examples.t line 168.
+# got: 'Can't zero_scalar(''): at cpan/autodie/t/hints_pod_examples.t line 157
+# '
+# expected: ''
+#
+#
+# my $scalar = zero_scalar("");
+# 1;
+
+
+foreach my $test (sort keys %scalar_tests) {
+ my $exception_expected= $scalar_tests{$test};
+ my $ok= eval(my $code= "
$perl58_fix
my \$scalar = $test;
- ";
+ 1;
+ ");
if ($exception_expected) {
- isnt("$@", "", "scalar test - $test");
+ isnt($ok ? "" : "$@", "", "scalar test - $test")
+ or diag($code);
}
else {
- is($@, "", "scalar test - $test");
+ is($ok ? "" : "$@", "", "scalar test - $test")
+ or diag($code);
}
}
-while (my ($test, $exception_expected) = each %list_tests) {
+
+# this set of test is not *known* to be order dependent however we sort it anyway out caution
+foreach my $test (sort keys %list_tests) {
+ my $exception_expected= $list_tests{$test};
eval "
$perl58_fix
my \@array = $test;