Upgrade to Test::Harness 2.46
[p5sagit/p5-mst-13.2.git] / lib / Test / Harness / t / prove-switches.t
CommitLineData
e4fc8a1e 1BEGIN {
2 if( $ENV{PERL_CORE} ) {
3 chdir 't';
4 @INC = ('../lib', 'lib');
5 }
6 else {
7 unshift @INC, 't/lib';
8 }
9}
10
11use strict;
12use File::Spec;
13use Test::More;
14plan skip_all => "Not adapted to perl core" if $ENV{PERL_CORE};
15plan skip_all => "Not installing prove" if -e "t/SKIP-PROVE";
16
3c87ea76 17# Work around a Cygwin bug. Remove this if Perl bug 30952 ever gets fixed.
18# http://rt.perl.org/rt3/Ticket/Display.html?id=30952.
19plan skip_all => "Skipping because of a Cygwin bug" if ( $^O =~ /cygwin/i );
20
60e33a80 21plan tests => 5;
e4fc8a1e 22
23my $blib = File::Spec->catfile( File::Spec->curdir, "blib" );
24my $blib_lib = File::Spec->catfile( $blib, "lib" );
25my $blib_arch = File::Spec->catfile( $blib, "arch" );
26my $prove = File::Spec->catfile( $blib, "script", "prove" );
27
28CAPITAL_TAINT: {
29 local $ENV{PROVE_SWITCHES};
60e33a80 30 local $/ = undef;
31
e4fc8a1e 32 my @actual = qx/$prove -Ifirst -D -I second -Ithird -Tvdb/;
33 my @expected = ( "# \$Test::Harness::Switches: -T -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n" );
42d29bac 34 is_deeply( \@actual, \@expected, "Capital taint flags OK" );
e4fc8a1e 35}
36
37LOWERCASE_TAINT: {
38 local $ENV{PROVE_SWITCHES};
60e33a80 39 local $/ = undef;
40
e4fc8a1e 41 my @actual = qx/$prove -dD -Ifirst -I second -t -Ithird -vb/;
42 my @expected = ( "# \$Test::Harness::Switches: -t -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n" );
42d29bac 43 is_deeply( \@actual, \@expected, "Lowercase taint OK" );
e4fc8a1e 44}
45
46PROVE_SWITCHES: {
47 local $ENV{PROVE_SWITCHES} = "-dvb -I fark";
60e33a80 48 local $/ = undef;
49
e4fc8a1e 50 my @actual = qx/$prove -Ibork -Dd/;
51 my @expected = ( "# \$Test::Harness::Switches: -I$blib_arch -I$blib_lib -Ifark -Ibork\n" );
42d29bac 52 is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
e4fc8a1e 53}
54
60e33a80 55PROVE_SWITCHES_L: {
56 local $/ = undef;
57
58 my @actual = qx/$prove -l -Ibongo -Dd/;
59 my @expected = ( "# \$Test::Harness::Switches: -Ilib -Ibongo\n" );
42d29bac 60 is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
60e33a80 61}
62
63PROVE_SWITCHES_LB: {
64 local $/ = undef;
65
66 my @actual = qx/$prove -lb -Dd/;
67 my @expected = ( "# \$Test::Harness::Switches: -Ilib -I$blib_arch -I$blib_lib\n" );
42d29bac 68 is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
e4fc8a1e 69}