Commit | Line | Data |
---|---|---|
e9c9ffca TR |
1 | #!perl -T |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use Test::More tests => 2; | |
7 | ||
8 | use Scalar::Util qw(tainted); | |
9 | use Locale::Maketext; | |
10 | ||
11 | my @ENV_values = values %ENV; | |
12 | my $tainted_value; | |
13 | do { $tainted_value = shift @ENV_values } while(!$tainted_value || ref $tainted_value); | |
6aac7955 | 14 | $tainted_value =~ s/([\[\]])/~$1/g; |
e9c9ffca | 15 | |
284167a5 S |
16 | # If ${^TAINT} is not set despite -T, thsi perl doesn't have taint support |
17 | 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'); | |
e9c9ffca TR |
18 | |
19 | my $result = Locale::Maketext::_compile("hello [_1]", $tainted_value); | |
20 | ||
21 | pass("_compile does not hang on tainted values"); | |
22 |