# -*- Mode: cperl; cperl-indent-level: 4 -*-
-# $Id: Harness.pm,v 1.47 2003/04/24 19:33:05 andy Exp $
+# $Id: Harness.pm,v 1.52 2003/07/17 19:02:48 andy Exp $
package Test::Harness;
$Have_Devel_Corestack = 0;
-$VERSION = '2.28';
+$VERSION = '2.29';
$ENV{HARNESS_ACTIVE} = 1;
}
}
-sub canonfailed ($@) {
+sub canonfailed ($$@) {
my($max,$skipped,@failed) = @_;
my %seen;
@failed = sort {$a <=> $b} grep !$seen{$_}++, @failed;
$self->{_old5lib} = $ENV{PERL5LIB};
- my @filtered_inc = $self->_filtered_INC;
- my @clean_inc = grep !/\Q$Config{path_sep}/, @filtered_inc;
- my @naughty_inc = grep /\Q$Config{path_sep}/, @filtered_inc;
- warn "Test::Harness can't handle \@INC directories with ".
- "'$Config{path_sep}': @naughty_inc\n" if @naughty_inc;
-
- return join $Config{path_sep}, @clean_inc;
+ return join $Config{path_sep}, $self->_filtered_INC;
}
=item B<_filtered_INC>
use strict;
-use Test::More tests => 6;
+use Test::More tests => 7;
-use Test::Harness::Assert;
+use_ok( 'Test::Harness::Assert' );
ok( defined &assert, 'assert() exported' );
test other other test other )],
);
-plan tests => scalar keys %samples;
+plan tests => 2 + scalar keys %samples;
-use Test::Harness::Straps;
+use_ok( 'Test::Harness::Straps' );
my $strap = Test::Harness::Straps->new;
+isa_ok( $strap, 'Test::Harness::Straps' );
$strap->{callback} = sub {
my($self, $line, $type, $totals) = @_;
push @out, $type;
},
);
-plan tests => (keys(%samples) * 4) + 3;
+plan tests => (keys(%samples) * 5) + 4;
use_ok('Test::Harness::Straps');
my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
my $strap = Test::Harness::Straps->new;
+ isa_ok( $strap, 'Test::Harness::Straps' );
my %results = $strap->analyze_file($test_path);
is_deeply($results{details}, $expect->{details}, "$test details" );
my $strap = Test::Harness::Straps->new;
+isa_ok( $strap, 'Test::Harness::Straps' );
ok( !$strap->analyze_file('I_dont_exist') );
is( $strap->{error}, "I_dont_exist does not exist" );
use strict;
-use Test::More tests => 147;
-
+use Test::More tests => 170;
use_ok('Test::Harness::Straps');
my $strap = Test::Harness::Straps->new;
-ok( defined $strap && $strap->isa("Test::Harness::Straps"), 'new()' );
-
+isa_ok( $strap, 'Test::Harness::Straps', 'new()' );
### Testing _is_comment()
while( my($line, $line_comment) = each %comments ) {
my $strap = Test::Harness::Straps->new;
+ isa_ok( $strap, 'Test::Harness::Straps' );
my $name = substr($line, 0, 20);
ok( $strap->_is_comment($line, \$comment), " comment '$name'" );
while( my($header, $expect) = each %headers ) {
my $strap = Test::Harness::Straps->new;
+ isa_ok( $strap, 'Test::Harness::Straps' );
ok( $strap->_is_header($header), "_is_header() is a header '$header'" );
);
foreach my $line (@untests) {
my $strap = Test::Harness::Straps->new;
+ isa_ok( $strap, 'Test::Harness::Straps' );
+
my %test = ();
ok( !$strap->_is_test($line, \%test), "_is_test() disregards '$line'" );
while( my($line, $expect) = each %bails ) {
my $strap = Test::Harness::Straps->new;
+ isa_ok( $strap, 'Test::Harness::Straps' );
+
my $reason;
ok( $strap->_is_bail_out($line, \$reason), "_is_bail_out() spots '$line'");
is( $reason, $expect, ' with the right reason' );
foreach my $line (@unbails) {
my $strap = Test::Harness::Straps->new;
+ isa_ok( $strap, 'Test::Harness::Straps' );
+
my $reason;
ok( !$strap->_is_bail_out($line, \$reason),
plan tests => (keys(%samples) * 8) + 1;
-use Test::Harness;
use_ok('Test::Harness');
+use Test::Harness; # So that we don't get "used only once" warnings on the next line
$Test::Harness::Switches = '"-Mstrict"';
tie *NULL, 'My::Dev::Null' or die $!;