=== Changes
==================================================================
--- Changes (revision 27687)
+++ Changes (local)
@@ -1,6 +1,12 @@
Revision history for Perl extension Test::Harness
NEXT
+ [ENHANCEMENTS]
+ * prove now runs with warnings on by default.
+ * Added prove -X to run warnings off.
+
+ [DOCUMENTATION]
+ * Documented -w and -W.
2.64 Fri Oct 6 15:05:34 CDT 2006
[FIXES]
=== bin/prove
==================================================================
--- bin/prove (revision 27687)
+++ bin/prove (local)
@@ -18,7 +18,7 @@
my $lib = 0;
my $recurse = 0;
my @includes = ();
-my @switches = ();
+my @switches = ("-w");
# Allow cuddling the paths with the -I
@ARGV = map { /^(-I)(.+)/ ? ($1,$2) : $_ } @ARGV;
@@ -42,8 +42,9 @@
's|shuffle' => \$shuffle,
't' => sub { unshift @switches, '-t' }, # Always want -t up front
'T' => sub { unshift @switches, '-T' }, # Always want -T up front
- 'w' => sub { push @switches, '-w' },
+ 'w' => sub { },
'W' => sub { push @switches, '-W' },
+ 'X' => sub { push @switches, '-X' },
'strap=s' => \$ENV{HARNESS_STRAP_CLASS},
'timer' => \$Test::Harness::Timer,
'v|verbose' => \$Test::Harness::verbose,
@@ -266,6 +267,18 @@
Display version info.
+=head2 -w
+
+Runs tests with warnings turned on (-w). This is the default so its effectively a no-op.
+
+=head2 -W
+
+Enables all warnings regardless of C<no warnings> using the -W flag. See L<perlrun> for details.
+
+=head2 -X
+
+Disables all warnings regardless of C<use warnings> using the -X flag. See L<perlrun> for details.
+
=head1 BUGS
Please use the CPAN bug ticketing system at L<
http://rt.cpan.org/>.
=== t/prove-switches.t
==================================================================
--- t/prove-switches.t (revision 27687)
+++ t/prove-switches.t (local)
@@ -18,7 +18,7 @@
#
http://rt.perl.org/rt3/Ticket/Display.html?id=30952.
plan skip_all => "Skipping because of a Cygwin bug" if ( $^O =~ /cygwin/i );
-plan tests => 9;
+plan tests => 12;
my $blib = File::Spec->catfile( File::Spec->curdir, "blib" );
my $blib_lib = File::Spec->catfile( $blib, "lib" );
@@ -31,7 +31,7 @@
my @actual = qx/$prove -Ifirst -D -I second -Ithird -Tvdb/;
my @expected = (
- "# \$Test::Harness::Switches: -T -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n",
+ "# \$Test::Harness::Switches: -T -w -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n",
"# perl to run tests: $^X\n"
);
is_deeply( \@actual, \@expected, "Capital taint flags OK" );
@@ -42,7 +42,7 @@
my @actual = qx/$prove -dD -Ifirst -I second -t -Ithird -vb/;
my @expected = (
- "# \$Test::Harness::Switches: -t -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n",
+ "# \$Test::Harness::Switches: -t -w -I$blib_arch -I$blib_lib -Ifirst -Isecond -Ithird\n",
"# perl to run tests: $^X\n"
);
is_deeply( \@actual, \@expected, "Lowercase taint OK" );
@@ -53,7 +53,7 @@
my @actual = qx/$prove -Ibork -Dd/;
my @expected = (
- "# \$Test::Harness::Switches: -I$blib_arch -I$blib_lib -Ifark -Ibork\n",
+ "# \$Test::Harness::Switches: -w -I$blib_arch -I$blib_lib -Ifark -Ibork\n",
"# perl to run tests: $^X\n"
);
is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
@@ -62,31 +62,32 @@
PROVE_SWITCHES_L: {
my @actual = qx/$prove -l -Ibongo -Dd/;
my @expected = (
- "# \$Test::Harness::Switches: -Ilib -Ibongo\n",
+ "# \$Test::Harness::Switches: -w -Ilib -Ibongo\n",
"# perl to run tests: $^X\n"
);
- is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
+ is_deeply( \@actual, \@expected, "prove -l" );
}
PROVE_SWITCHES_LB: {
my @actual = qx/$prove -lb -Dd/;
my @expected = (
- "# \$Test::Harness::Switches: -Ilib -I$blib_arch -I$blib_lib\n",
+ "# \$Test::Harness::Switches: -w -Ilib -I$blib_arch -I$blib_lib\n",
"# perl to run tests: $^X\n"
);
- is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
+ is_deeply( \@actual, \@expected, "prove -lb OK" );
}
PROVE_SWITCHES_PERL: {
my @actual = qx/$prove --perl=wibble -Dd/;
my @expected = (
- "# \$Test::Harness::Switches: \n",
+ "# \$Test::Harness::Switches: -w\n",
"# perl to run tests: wibble\n"
);
- is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
+ is_deeply( \@actual, \@expected, "prove --perl OK" );
}
+
PROVE_VERSION: {
# This also checks that the prove $VERSION is in sync with Test::Harness's $VERSION
local $/ = undef;
@@ -98,3 +99,33 @@
is( scalar @actual, 1, 'Only 1 line returned' );
like( $actual[0], qq{/^\Qprove v$thv, using Test::Harness v$thv and Perl v5\E/} );
}
+
+
+PROVE_SWITCHES_WARN: {
+ my @actual = qx/$prove -w -Dd/;
+ my @expected = (
+ "# \$Test::Harness::Switches: -w\n",
+ "# perl to run tests: $^X\n"
+ );
+ is_deeply( \@actual, \@expected, "prove -w OK" );
+}
+
+
+PROVE_SWITCHES_REALLY_WARN: {
+ my @actual = qx/$prove -W -Dd/;
+ my @expected = (
+ "# \$Test::Harness::Switches: -w -W\n",
+ "# perl to run tests: $^X\n"
+ );
+ is_deeply( \@actual, \@expected, "prove -W OK" );
+}
+
+
+PROVE_SWITCHES_NO_WARN: {
+ my @actual = qx/$prove -X -Dd/;
+ my @expected = (
+ "# \$Test::Harness::Switches: -w -X\n",
+ "# perl to run tests: $^X\n"
+ );
+ is_deeply( \@actual, \@expected, "prove -X OK" );
+}