|
Packit |
f92f8e |
#!perl -T
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
use strict;
|
|
Packit |
f92f8e |
use warnings;
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
use Test::More tests => 2;
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
use Scalar::Util qw(tainted);
|
|
Packit |
f92f8e |
use Locale::Maketext;
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
my @ENV_values = map { !/^PERL/ && defined($ENV{$_}) && !ref($ENV{$_}) && $ENV{$_} ? $ENV{$_} : () } sort keys %ENV;
|
|
Packit |
f92f8e |
die "No %ENV vars to test?" if !@ENV_values;
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
my ($tainted_value)= @ENV_values;
|
|
Packit |
f92f8e |
$tainted_value =~ s/([\[\]])/~$1/g;
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
# If ${^TAINT} is not set despite -T, this perl doesn't have taint support
|
|
Packit |
f92f8e |
ok(!${^TAINT} || tainted($tainted_value), "\$tainted_value is tainted")
|
|
Packit |
f92f8e |
or die("Could not find tainted value to use for testing (maybe fix the test?)");
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
my $result = Locale::Maketext::_compile("hello [_1]", $tainted_value);
|
|
Packit |
f92f8e |
|
|
Packit |
f92f8e |
pass("_compile does not hang on tainted values");
|
|
Packit |
f92f8e |
|