Revision history for Perl extension Test::Harness
-2.40 Tue Dec 30 20:38:59 CST 2003
+2.42 Wed Apr 28 22:13:11 CDT 2004
+ [ENHANCEMENTS]
+ * prove -v now sets TEST_VERBOSE in case your tests rely on them.
+ * prove globs the command line, since Win32's shell doesn't.
+
+ [FIXES]
+ * Cross-platform test fixes on t/prove-globbing.t
+
+
+2.40 Tue Dec 30 20:38:59 CST 2003
[FIXES]
* Test::Harness::Straps should now properly quote on VMS.
underscores, to indicate such.
* Gratuitous text-only changes in Test::Harness::Iterator.
-
+
* All tests now do their use_ok() in a BEGIN block. Some of the
use_ok() calls were too much of a hassle to put into a BEGIN block,
so I changed them to regular use calls.
-2.38 Mon Nov 24 22:36:18 CST 2003
+2.38 Mon Nov 24 22:36:18 CST 2003
Released. See changes below.
-2.37_03 Tue Nov 18 23:51:38 CST 2003
+2.37_03 Tue Nov 18 23:51:38 CST 2003
[ENHANCEMENTS]
* prove -V now shows the Perl version being used.
* Now there's a HARNESS_DEBUG flag that shows diagnostics as the
Getopt::Long::Configure( "bundling" );
GetOptions(
'b|blib' => \$blib,
- 'd|debug' => \$Test::Harness::debug,
+ 'd|debug' => \$Test::Harness::debug,
'D|dry' => \$dry,
'h|help|?' => sub {pod2usage({-verbose => 1, -input => \*DATA}); exit},
'H|man' => sub {pod2usage({-verbose => 2, -input => \*DATA}); exit},
'I=s@' => \@includes,
- 'l|lib' => \$lib,
+ 'l|lib' => \$lib,
'r|recurse' => \$recurse,
's|shuffle' => \$shuffle,
- 't' => sub { unshift @switches, "-t" }, # Always want -t up front
- 'T' => sub { unshift @switches, "-T" }, # Always want -T up front
+ 't' => sub { unshift @switches, "-t" }, # Always want -t up front
+ 'T' => sub { unshift @switches, "-T" }, # Always want -T up front
'v|verbose' => \$Test::Harness::verbose,
'V|version' => sub { print_version(); exit; },
'ext=s@' => \@ext,
) or exit 1;
+$ENV{TEST_VERBOSE} = 1 if $Test::Harness::verbose;
+
# Build up extensions regex
@ext = map { split /,/ } @ext;
s/^\.// foreach @ext;
if ( $blib ) {
my @blibdirs = blibdirs();
if ( @blibdirs ) {
- unshift @includes, @blibdirs;
+ unshift @includes, @blibdirs;
} else {
- warn "No blib directories found.\n";
+ warn "No blib directories found.\n";
}
}
my @tests;
@ARGV = File::Spec->curdir unless @ARGV;
-push( @tests, -d $_ ? all_in( $_ ) : $_ ) for @ARGV;
+push( @tests, -d $_ ? all_in( $_ ) : $_ ) for map { glob } @ARGV;
if ( @tests ) {
shuffle(@tests) if $shuffle;
if ( $dry ) {
print join( "\n", @tests, "" );
} else {
- print "# ", scalar @tests, " tests to run\n" if $Test::Harness::debug;
+ print "# ", scalar @tests, " tests to run\n" if $Test::Harness::debug;
runtests(@tests);
}
}
sub print_version {
printf( "prove v%s, using Test::Harness v%s and Perl v%vd\n",
- $VERSION, $Test::Harness::VERSION, $^V );
+ $VERSION, $Test::Harness::VERSION, $^V );
}
# Stolen directly from blib.pm
sub blibdirs {
my $dir = File::Spec->curdir;
if ($^O eq 'VMS') {
- ($dir = VMS::Filespec::unixify($dir)) =~ s-/\z--;
+ ($dir = VMS::Filespec::unixify($dir)) =~ s-/\z--;
}
my $archdir = "arch";
if ( $^O eq "MacOS" ) {
- # Double up the MP::A so that it's not used only once.
- $archdir = $MacPerl::Architecture = $MacPerl::Architecture;
+ # Double up the MP::A so that it's not used only once.
+ $archdir = $MacPerl::Architecture = $MacPerl::Architecture;
}
my $i = 5;
my $blib_lib = File::Spec->catdir( $blib, "lib" );
my $blib_arch = File::Spec->catdir( $blib, $archdir );
- if ( -d $blib && -d $blib_arch && -d $blib_lib ) {
- return ($blib_arch,$blib_lib);
- }
- $dir = File::Spec->catdir($dir, File::Spec->updir);
+ if ( -d $blib && -d $blib_arch && -d $blib_lib ) {
+ return ($blib_arch,$blib_lib);
+ }
+ $dir = File::Spec->catdir($dir, File::Spec->updir);
}
warn "$0: Cannot find blib\n";
return;
Options:
-b, --blib Adds blib/lib to the path for your tests, a la "use blib".
- -d, --debug Includes extra debugging information.
+ -d, --debug Includes extra debugging information.
-D, --dry Dry run: Show the tests to run, but don't run them.
--ext=x Extensions (defaults to .t)
-h, --help Display this help
-H, --man Longer manpage for prove
-I Add libraries to @INC, as Perl's -I
- -l, --lib Add lib to the path for your tests.
+ -l, --lib Add lib to the path for your tests.
-r, --recurse Recursively descend into directories.
-s, --shuffle Run the tests in a random order.
- -T Enable tainting checks
- -t Enable tainting warnings
+ -T Enable tainting checks
+ -t Enable tainting warnings
-v, --verbose Display standard output of test scripts while running them.
-V, --version Display version info
=head2 -v, --verbose
-Display standard output of test scripts while running them.
+Display standard output of test scripts while running them. Also sets
+TEST_VERBOSE in case your tests rely on them.
=head2 -V, --version
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" );
- array_match_ok( \@actual, \@expected, "Capital taint flags OK" );
+ is_deeply( \@actual, \@expected, "Capital taint flags OK" );
}
LOWERCASE_TAINT: {
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" );
- array_match_ok( \@actual, \@expected, "Lowercase taint OK" );
+ is_deeply( \@actual, \@expected, "Lowercase taint OK" );
}
PROVE_SWITCHES: {
my @actual = qx/$prove -Ibork -Dd/;
my @expected = ( "# \$Test::Harness::Switches: -I$blib_arch -I$blib_lib -Ifark -Ibork\n" );
- array_match_ok( \@actual, \@expected, "PROVE_SWITCHES OK" );
+ is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
}
PROVE_SWITCHES_L: {
my @actual = qx/$prove -l -Ibongo -Dd/;
my @expected = ( "# \$Test::Harness::Switches: -Ilib -Ibongo\n" );
- array_match_ok( \@actual, \@expected, "PROVE_SWITCHES OK" );
+ is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
}
PROVE_SWITCHES_LB: {
my @actual = qx/$prove -lb -Dd/;
my @expected = ( "# \$Test::Harness::Switches: -Ilib -I$blib_arch -I$blib_lib\n" );
- array_match_ok( \@actual, \@expected, "PROVE_SWITCHES OK" );
-}
-
-
-sub array_match_ok {
- my $actual = shift;
- my $expected = shift;
- my $message = shift;
- my $n = 0;
-
- my @actual = @$actual;
- my @expected = @$expected;
-
- while ( @actual && @expected ) {
- return ok( 0, "Differs at element $n: $message" ) if shift @actual ne shift @expected;
- ++$n;
- }
- return ok( 0, "Too many actual: $message" ) if @actual;
- return ok( 0, "Too many expected: $message" ) if @expected;
-
- return ok( 1, $message );
+ is_deeply( \@actual, \@expected, "PROVE_SWITCHES OK" );
}