Commit | Line | Data |
b965d173 |
1 | #!/usr/bin/perl -w |
2 | |
3 | BEGIN { |
2adbc9b6 |
4 | unshift @INC, 't/lib'; |
b965d173 |
5 | } |
6 | |
bdaf8c65 |
7 | # Test that options in PERL5OPT are propogated to tainted tests |
b965d173 |
8 | |
9 | use strict; |
bdaf8c65 |
10 | use Test::More ( $^O eq 'VMS' ? ( skip_all => 'VMS' ) : ( tests => 1 ) ); |
b965d173 |
11 | |
12 | use Config; |
13 | use TAP::Parser; |
14 | |
5e2a19fc |
15 | my $lib_path = join( ', ', map "'$_'", grep !ref, grep defined, @INC ); |
16 | |
b965d173 |
17 | sub run_test_file { |
18 | my ( $test_template, @args ) = @_; |
19 | |
5e2a19fc |
20 | my $test_file = 'temp_test.tmp'; |
b965d173 |
21 | |
22 | open TEST, ">$test_file" or die $!; |
23 | printf TEST $test_template, @args; |
24 | close TEST; |
25 | |
bdaf8c65 |
26 | my $p = TAP::Parser->new( |
27 | { source => $test_file, |
28 | |
29 | # Test taint when there's spaces in a -I path |
30 | switches => [q["-Ifoo bar"]], |
31 | } |
32 | ); |
b965d173 |
33 | 1 while $p->next; |
34 | ok !$p->has_problems; |
35 | |
36 | unlink $test_file; |
37 | } |
38 | |
39 | { |
2adbc9b6 |
40 | local $ENV{PERL5OPT} = $ENV{PERL_CORE} ? '-I../../lib -Mstrict' : '-Mstrict'; |
b965d173 |
41 | run_test_file(<<'END'); |
42 | #!/usr/bin/perl -T |
43 | |
44 | print "1..1\n"; |
45 | print $INC{'strict.pm'} ? "ok 1\n" : "not ok 1\n"; |
46 | END |
47 | } |
48 | |
49 | 1; |