Commit | Line | Data |
e4fc8a1e |
1 | BEGIN { |
2 | if( $ENV{PERL_CORE} ) { |
3 | chdir 't'; |
4 | @INC = ('../lib', 'lib'); |
5 | } |
6 | else { |
7 | unshift @INC, 't/lib'; |
8 | } |
9 | } |
10 | |
11 | use strict; |
12 | use File::Spec; |
13 | use Test::More; |
14 | plan skip_all => "Not adapted to perl core" if $ENV{PERL_CORE}; |
15 | plan 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. |
19 | plan skip_all => "Skipping because of a Cygwin bug" if ( $^O =~ /cygwin/i ); |
20 | |
5b1ebecd |
21 | plan tests => 8; |
e4fc8a1e |
22 | |
23 | my $blib = File::Spec->catfile( File::Spec->curdir, "blib" ); |
24 | my $blib_lib = File::Spec->catfile( $blib, "lib" ); |
25 | my $blib_arch = File::Spec->catfile( $blib, "arch" ); |
26 | my $prove = File::Spec->catfile( $blib, "script", "prove" ); |
20f9f807 |
27 | $prove = "$^X $prove"; |
e4fc8a1e |
28 | |
29 | CAPITAL_TAINT: { |
30 | local $ENV{PROVE_SWITCHES}; |
60e33a80 |
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 | |
37 | LOWERCASE_TAINT: { |
38 | local $ENV{PROVE_SWITCHES}; |
60e33a80 |
39 | |
e4fc8a1e |
40 | my @actual = qx/$prove -dD -Ifirst -I second -t -Ithird -vb/; |
41 | my @expected = ( "# \$Test::Harness::Switches: -t -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n" ); |
42d29bac |
42 | is_deeply( \@actual, \@expected, "Lowercase taint OK" ); |
e4fc8a1e |
43 | } |
44 | |
45 | PROVE_SWITCHES: { |
46 | local $ENV{PROVE_SWITCHES} = "-dvb -I fark"; |
60e33a80 |
47 | |
e4fc8a1e |
48 | my @actual = qx/$prove -Ibork -Dd/; |
49 | my @expected = ( "# \$Test::Harness::Switches: -I$blib_arch -I$blib_lib -Ifark -Ibork\n" ); |
42d29bac |
50 | is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" ); |
e4fc8a1e |
51 | } |
52 | |
60e33a80 |
53 | PROVE_SWITCHES_L: { |
60e33a80 |
54 | my @actual = qx/$prove -l -Ibongo -Dd/; |
55 | my @expected = ( "# \$Test::Harness::Switches: -Ilib -Ibongo\n" ); |
42d29bac |
56 | is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" ); |
60e33a80 |
57 | } |
58 | |
59 | PROVE_SWITCHES_LB: { |
60e33a80 |
60 | my @actual = qx/$prove -lb -Dd/; |
61 | my @expected = ( "# \$Test::Harness::Switches: -Ilib -I$blib_arch -I$blib_lib\n" ); |
42d29bac |
62 | is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" ); |
e4fc8a1e |
63 | } |
5b1ebecd |
64 | |
65 | PROVE_VERSION: { |
66 | # This also checks that the prove $VERSION is in sync with Test::Harness's $VERSION |
67 | local $/ = undef; |
68 | |
69 | use_ok( 'Test::Harness' ); |
70 | |
71 | my $thv = $Test::Harness::VERSION; |
72 | my @actual = qx/$prove --version/; |
73 | is( scalar @actual, 1, 'Only 1 line returned' ); |
74 | like( $actual[0], qq{/^\Qprove v$thv, using Test::Harness v$thv and Perl v5\E/} ); |
75 | } |