From: Nikola Knezevic Date: Tue, 28 May 2002 08:17:53 +0000 (+0200) Subject: Test::Harness and skiping tests functionality X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=195d559b8ef22ad8837051fd15a3100fca99b37f;p=p5sagit%2Fp5-mst-13.2.git Test::Harness and skiping tests functionality Message-ID: <40949173.20020528081753@tesla.rcub.bg.ac.yu> p4raw-id: //depot/perl@16829 --- diff --git a/ext/POSIX/t/waitpid.t b/ext/POSIX/t/waitpid.t index f2e9c06..e163371 100644 --- a/ext/POSIX/t/waitpid.t +++ b/ext/POSIX/t/waitpid.t @@ -6,17 +6,17 @@ BEGIN { BEGIN { use Config; unless ($Config{d_fork}) { - print "1..0 # no fork\n"; + print "1..0 # Skip: no fork\n"; exit 0; } eval { use POSIX qw(sys_wait_h) }; if ($@) { - print "1..0 # no POSIX sys_wait_h\n"; + print "1..0 # Skip: no POSIX sys_wait_h\n"; exit 0; } eval { use Time::HiRes qw(time) }; if ($@) { - print "1..0 # no Time::HiRes\n"; + print "1..0 # Skip: no Time::HiRes\n"; exit 0; } } diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 0efaa53..be04797 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -159,6 +159,13 @@ emitted if the test script is skipped completely: 1..0 # Skipped: no leverage found +If you don't have any comment on skipping, just print C<1..0> with +nothing after it. Test::Harness will say something like this: + +op/64bitint..............skipped + skipped: no reason given + + =item B If the standard output line contains the substring C< # TODO> after diff --git a/lib/Test/Harness/Straps.pm b/lib/Test/Harness/Straps.pm index 173b26b..8ce5722 100644 --- a/lib/Test/Harness/Straps.pm +++ b/lib/Test/Harness/Straps.pm @@ -444,7 +444,11 @@ sub _is_header { $self->{max} = $max; assert( $self->{max} >= 0, 'Max # of tests looks right' ); - if( defined $extra ) { + if( not $max and not $extra) { + #We're skipping, thats for sure + $self->{skip_all} = 'no reason given'; + } + elsif( defined $extra ) { my($todo, $skip, $reason) = $extra =~ /$Extra_Header_Re/xo; $self->{todo} = { map { $_ => 1 } split /\s+/, $todo } if $todo; diff --git a/t/op/64bitint.t b/t/op/64bitint.t index 494f9fd..e8314fa 100644 --- a/t/op/64bitint.t +++ b/t/op/64bitint.t @@ -3,7 +3,7 @@ BEGIN { eval { my $q = pack "q", 0 }; if ($@) { - print "1..0\n# Skip: no 64-bit types\n"; + print "1..0 # Skip: no 64-bit types\n"; exit(0); } chdir 't' if -d 't'; diff --git a/t/test.pl b/t/test.pl index 7df12b6..9b3d9d6 100644 --- a/t/test.pl +++ b/t/test.pl @@ -40,7 +40,7 @@ sub _diag { sub skip_all { if (@_) { - print STDOUT "1..0 - @_\n"; + print STDOUT "1..0 # Skipped: @_\n"; } else { print STDOUT "1..0\n"; }