diff options
author | Yves Orton <demerphq@gmail.com> | 2012-11-22 00:43:14 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2012-11-22 00:43:14 +0100 |
commit | 9b3baf436d62d0adc3157f11a08748ff53e90960 (patch) | |
tree | 6370cb1b9dd378f68763b484709cbc01de37ac58 /dist/Locale-Maketext | |
parent | 5cc8528c900964306cba9b53c6eaa27af540eaea (diff) | |
download | perl-9b3baf436d62d0adc3157f11a08748ff53e90960.tar.gz |
fix hash order dependency bug in Local-Maketext/t/09_compile.t
This would occasionally fail if it ended up encountering PERL5LIB in the environment hash
as the first value.
The test was actually broken anyway, as it would infinitie loop with a totally empty environment
Diffstat (limited to 'dist/Locale-Maketext')
-rw-r--r-- | dist/Locale-Maketext/t/09_compile.t | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dist/Locale-Maketext/t/09_compile.t b/dist/Locale-Maketext/t/09_compile.t index d03ba9fa14..3c00f59246 100644 --- a/dist/Locale-Maketext/t/09_compile.t +++ b/dist/Locale-Maketext/t/09_compile.t @@ -8,13 +8,15 @@ use Test::More tests => 2; use Scalar::Util qw(tainted); use Locale::Maketext; -my @ENV_values = values %ENV; -my $tainted_value; -do { $tainted_value = shift @ENV_values } while(!$tainted_value || ref $tainted_value); +my @ENV_values = map { !/^PERL/ && defined($ENV{$_}) && !ref($ENV{$_}) && $ENV{$_} ? $ENV{$_} : () } keys %ENV; +die "No %ENV vars to test?" if !@ENV_values; + +my ($tainted_value)= @ENV_values; $tainted_value =~ s/([\[\]])/~$1/g; -# If ${^TAINT} is not set despite -T, thsi perl doesn't have taint support -ok(!${^TAINT} || tainted($tainted_value), "\$tainted_value is tainted") or die('huh... %ENV has no entries? I don\'t know how to test taint without it'); +# If ${^TAINT} is not set despite -T, this perl doesn't have taint support +ok(!${^TAINT} || tainted($tainted_value), "\$tainted_value is tainted") + or die("Could not find tainted value to use for testing (maybe fix the test?)"); my $result = Locale::Maketext::_compile("hello [_1]", $tainted_value); |