Change 16155 by jhi@alpha on 2002/04/25 14:27:07
Subject: [PATCH] Test::Harness 2.01 -> 2.03
From: Michael G Schwern <[EMAIL PROTECTED]>
Date: Thu, 25 Apr 2002 01:51:27 -0400
Message-ID: <20020425055127.GB3456@blackrider>
Affected files ...
.... //depot/perl/MANIFEST#860 edit
.... //depot/perl/lib/Test/Harness.pm#59 edit
.... //depot/perl/lib/Test/Harness/Changes#4 edit
.... //depot/perl/lib/Test/Harness/Straps.pm#2 edit
.... //depot/perl/lib/Test/Harness/t/strap-analyze.t#2 edit
.... //depot/perl/lib/Test/Harness/t/test-harness.t#5 edit
.... //depot/perl/t/lib/sample-tests/bignum#1 add
.... //depot/perl/t/lib/sample-tests/die#1 add
.... //depot/perl/t/lib/sample-tests/die_head_end#1 add
.... //depot/perl/t/lib/sample-tests/die_last_minute#1 add
.... //depot/perl/t/lib/sample-tests/taint#2 edit
Differences ...
==== //depot/perl/MANIFEST#860 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST.~1~ Thu Apr 25 08:30:06 2002
+++ perl/MANIFEST Thu Apr 25 08:30:06 2002
@@ -2343,8 +2343,12 @@
t/lib/Math/BigInt/Subclass.pm Empty subclass of BigInt for test
t/lib/Math/BigRat/Test.pm Math::BigRat test helper
t/lib/sample-tests/bailout Test data for Test::Harness
+t/lib/sample-tests/bignum Test data for Test::Harness
t/lib/sample-tests/combined Test data for Test::Harness
t/lib/sample-tests/descriptive Test data for Test::Harness
+t/lib/sample-tests/die Test data for Test::Harness
+t/lib/sample-tests/die_head_end Test data for Test::Harness
+t/lib/sample-tests/die_last_minute Test data for Test::Harness
t/lib/sample-tests/duplicates Test data for Test::Harness
t/lib/sample-tests/head_end Test data for Test::Harness
t/lib/sample-tests/head_fail Test data for Test::Harness
==== //depot/perl/lib/Test/Harness.pm#59 (text) ====
Index: perl/lib/Test/Harness.pm
--- perl/lib/Test/Harness.pm.~1~ Thu Apr 25 08:30:06 2002
+++ perl/lib/Test/Harness.pm Thu Apr 25 08:30:06 2002
@@ -1,5 +1,5 @@
# -*- Mode: cperl; cperl-indent-level: 4 -*-
-# $Id: Harness.pm,v 1.14.2.13 2002/01/07 22:34:32 schwern Exp $
+# $Id: Harness.pm,v 1.14.2.18 2002/04/25 05:04:35 schwern Exp $
package Test::Harness;
@@ -22,7 +22,7 @@
$Have_Devel_Corestack = 0;
-$VERSION = '2.01';
+$VERSION = '2.03';
$ENV{HARNESS_ACTIVE} = 1;
@@ -36,16 +36,13 @@
my $Files_In_Dir = $ENV{HARNESS_FILELEAK_IN_DIR};
-my $Running_In_Perl_Tree = 0;
-++$Running_In_Perl_Tree if -d "../t" and -f "../sv.c";
-
my $Strap = Test::Harness::Straps->new;
@ISA = ('Exporter');
@EXPORT = qw(&runtests);
@EXPORT_OK = qw($verbose $switches);
-$Verbose = 0;
+$Verbose = $ENV{HARNESS_VERBOSE} || 0;
$Switches = "-w";
$Columns = $ENV{HARNESS_COLUMNS} || $ENV{COLUMNS} || 80;
$Columns--; # Some shells have trouble with a full line of text.
@@ -90,15 +87,16 @@
=item B<'1..M'>
-This header tells how many tests there will be. It should be the
-first line output by your test program (but it is okay if it is preceded
-by comments).
+This header tells how many tests there will be. For example, C<1..10>
+means you plan on running 10 tests. This is a safeguard in case your
+test dies quietly in the middle of its run.
+
+It should be the first non-comment line output by your test program.
-In certain instanced, you may not know how many tests you will
-ultimately be running. In this case, it is permitted (but not
-encouraged) for the 1..M header to appear as the B<last> line output
-by your test (again, it can be followed by further comments). But we
-strongly encourage you to put it first.
+In certain instances, you may not know how many tests you will
+ultimately be running. In this case, it is permitted for the 1..M
+header to appear as the B<last> line output by your test (again, it
+can be followed by further comments).
Under B<no> circumstances should 1..M appear in the middle of your
output or more than once.
@@ -152,7 +150,7 @@
counted as a skipped test. If the whole testscript succeeds, the
count of skipped tests is included in the generated output.
C<Test::Harness> reports the text after C< # Skip\S*\s+> as a reason
-for skipping.
+for skipping.
ok 23 # skip Insufficient flogiston pressure.
@@ -457,6 +455,8 @@
my $fh = _open_test($tfile);
+ $tot{files}++;
+
# state of the current test.
my %test = (
ok => 0,
@@ -602,11 +602,7 @@
chomp($te);
$te =~ s/\.\w+$/./;
- if ($^O eq 'VMS') {
- $te =~ s/^.*\.t\./\[.t./s;
- }
- $te =~ s,\\,/,g if $^O eq 'MSWin32';
- $te =~ s,^\.\./,/, if $Running_In_Perl_Tree;
+ if ($^O eq 'VMS') { $te =~ s/^.*\.t\./\[.t./s; }
my $blank = (' ' x 77);
my $leader = "$te" . '.' x ($width - length($te));
my $ml = "";
@@ -632,15 +628,12 @@
foreach (@_) {
my $suf = /\.(\w+)$/ ? $1 : '';
my $len = length;
- $len -= 2 if $Running_In_Perl_Tree and m{^\.\.[/\\]};
my $suflen = length $suf;
$maxlen = $len if $len > $maxlen;
$maxsuflen = $suflen if $suflen > $maxsuflen;
}
- # we want three dots between the test name and the "ok" for
- # typical lengths, and just two dots if longer than 30 characters
- $maxlen -= $maxsuflen;
- return $maxlen + ($maxlen >= 30 ? 2 : 3);
+ # + 3 : we want three dots between the test name and the "ok"
+ return $maxlen + 3 - $maxsuflen;
}
@@ -703,7 +696,6 @@
$tot->{max} += $test->{max};
- $tot->{files}++;
}
else {
$is_header = 0;
@@ -718,11 +710,13 @@
my $s = _set_switches($test);
+ my $perl = -x $^X ? $^X : $Config{perlpath};
+
# XXX This is WAY too core specific!
my $cmd = ($ENV{'HARNESS_COMPILE_TEST'})
? "./perl -I../lib ../utils/perlcc $test "
. "-r 2>> ./compilelog |"
- : "$^X $s $test|";
+ : "$perl $s $test|";
$cmd = "MCR $cmd" if $^O eq 'VMS';
if( open(PERL, $cmd) ) {
@@ -756,17 +750,14 @@
}
$test->{todo}{$this} = 1 if $istodo;
+ if( $test->{todo}{$this} ) {
+ $tot->{todo}++;
+ $test->{bonus}++, $tot->{bonus}++ unless $not;
+ }
- $tot->{todo}++ if $test->{todo}{$this};
-
- if( $not ) {
+ if( $not && !$test->{todo}{$this} ) {
print "$test->{ml}NOK $this" if $test->{ml};
- if (!$test->{todo}{$this}) {
- push @{$test->{failed}}, $this;
- } else {
- $test->{ok}++;
- $tot->{ok}++;
- }
+ push @{$test->{failed}}, $this;
}
else {
print "$test->{ml}ok $this/$test->{max}" if $test->{ml};
@@ -783,13 +774,18 @@
} elsif (defined $reason) {
$test->{skip_reason} = $reason;
}
-
- $test->{bonus}++, $tot->{bonus}++ if $test->{todo}{$this};
}
if ($this > $test->{'next'}) {
print "Test output counter mismatch [test $this]\n";
- push @{$test->{failed}}, $test->{'next'}..$this-1;
+
+ # Guard against resource starvation.
+ if( $this > 100000 ) {
+ print "Enourmous test number seen [test $this]\n";
+ }
+ else {
+ push @{$test->{failed}}, $test->{'next'}..$this-1;
+ }
}
elsif ($this < $test->{'next'}) {
#we have seen more "ok" lines than the number suggests
@@ -971,13 +967,17 @@
sub corestatus {
my($st) = @_;
- eval {require 'wait.ph'};
- my $ret = defined &WCOREDUMP ? WCOREDUMP($st) : $st & 0200;
+ eval {
+ local $^W = 0; # *.ph files are often *very* noisy
+ require 'wait.ph'
+ };
+ return if $@;
+ my $did_core = defined &WCOREDUMP ? WCOREDUMP($st) : $st & 0200;
eval { require Devel::CoreStack; $Have_Devel_Corestack++ }
unless $tried_devel_corestack++;
- $ret;
+ return $did_core;
}
}
@@ -1079,17 +1079,18 @@
=over 4
-=item C<HARNESS_IGNORE_EXITCODE>
+=item C<HARNESS_ACTIVE>
-Makes harness ignore the exit status of child processes when defined.
+Harness sets this before executing the individual tests. This allows
+the tests to determine if they are being executed through the harness
+or by any other means.
-=item C<HARNESS_NOTTY>
+=item C<HARNESS_COLUMNS>
-When set to a true value, forces it to behave as though STDOUT were
-not a console. You may need to set this if you don't want harness to
-output more frequent progress messages using carriage returns. Some
-consoles may not handle carriage returns properly (which results in a
-somewhat messy output).
+This value will be used for the width of the terminal. If it is not
+set then it will default to C<COLUMNS>. If this is not set, it will
+default to 80. Note that users of Bourne-sh based shells will need to
+C<export COLUMNS> for this module to use that variable.
=item C<HARNESS_COMPILE_TEST>
@@ -1110,24 +1111,28 @@
the moment runtests() was called. Putting absolute path into
C<HARNESS_FILELEAK_IN_DIR> may give more predictable results.
+=item C<HARNESS_IGNORE_EXITCODE>
+
+Makes harness ignore the exit status of child processes when defined.
+
+=item C<HARNESS_NOTTY>
+
+When set to a true value, forces it to behave as though STDOUT were
+not a console. You may need to set this if you don't want harness to
+output more frequent progress messages using carriage returns. Some
+consoles may not handle carriage returns properly (which results in a
+somewhat messy output).
+
=item C<HARNESS_PERL_SWITCHES>
Its value will be prepended to the switches used to invoke perl on
each test. For example, setting C<HARNESS_PERL_SWITCHES> to C<-W> will
run all tests with all warnings enabled.
-=item C<HARNESS_COLUMNS>
+=item C<HARNESS_VERBOSE>
-This value will be used for the width of the terminal. If it is not
-set then it will default to C<COLUMNS>. If this is not set, it will
-default to 80. Note that users of Bourne-sh based shells will need to
-C<export COLUMNS> for this module to use that variable.
-
-=item C<HARNESS_ACTIVE>
-
-Harness sets this before executing the individual tests. This allows
-the tests to determine if they are being executed through the harness
-or by any other means.
+If true, Test::Harness will output the verbose results of running
+its tests. Setting $Test::Harness::verbose will override this.
=back
@@ -1167,7 +1172,7 @@
Provide a way of running tests quietly (ie. no printing) for automated
validation of tests. This will probably take the form of a version
of runtests() which rather than printing its output returns raw data
-on the state of the tests.
+on the state of the tests. (Partially done in Test::Harness::Straps)
Fix HARNESS_COMPILE_TEST without breaking its core usage.
@@ -1175,8 +1180,6 @@
Rework the test summary so long test names are not truncated as badly.
-Merge back into bleadperl.
-
Deal with VMS's "not \nok 4\n" mistake.
Add option for coverage analysis.
@@ -1189,13 +1192,7 @@
=head1 BUGS
-Test::Harness uses $^X to determine the perl binary to run the tests
-with. Test scripts running via the shebang (C<#!>) line may not be
-portable because $^X is not consistent for shebang scripts across
-platforms. This is no problem when Test::Harness is run with an
-absolute path to the perl binary or when $^X can be found in the path.
-
-HARNESS_COMPILE_TEST currently assumes it is run from the Perl source
+HARNESS_COMPILE_TEST currently assumes it's run from the Perl source
directory.
=cut
==== //depot/perl/lib/Test/Harness/Changes#4 (text) ====
Index: perl/lib/Test/Harness/Changes
--- perl/lib/Test/Harness/Changes.~1~ Thu Apr 25 08:30:06 2002
+++ perl/lib/Test/Harness/Changes Thu Apr 25 08:30:06 2002
@@ -1,5 +1,24 @@
Revision history for Perl extension Test::Harness
+2.03 Thu Apr 25 01:01:34 EDT 2002
+ * $^X fix made safer.
+ - Noise from loading wait.ph to analyze core files supressed
+ - MJD found a situation where a test could run Test::Harness
+ out of memory. Protecting against that specific case.
+ - Made the 1..M docs a bit clearer.
+ - Fixed TODO tests so Test::Harness does not display a NOK for
+ them.
+ - Test::Harness::Straps->analyze_file() docs were not clear as to
+ its effects
+
+2.02 Thu Mar 14 18:06:04 EST 2002
+ * Ken Williams fixed the long standing $^X bug.
+ * Added HARNESS_VERBOSE
+ * Fixed a bug where Test::Harness::Straps was considering a test that
+ is ok but died as passing.
+ - Added the exit and wait codes of the test to the
+ analyze_file() results.
+
2.01 Thu Dec 27 18:54:36 EST 2001
* Added 'passing' to the results to tell you if the test passed
* Added Test::Harness::Straps example (examples/mini_harness.plx)
==== //depot/perl/lib/Test/Harness/Straps.pm#2 (text) ====
Index: perl/lib/Test/Harness/Straps.pm
--- perl/lib/Test/Harness/Straps.pm.~1~ Thu Apr 25 08:30:06 2002
+++ perl/lib/Test/Harness/Straps.pm Thu Apr 25 08:30:06 2002
@@ -1,12 +1,12 @@
# -*- Mode: cperl; cperl-indent-level: 4 -*-
-# $Id: Straps.pm,v 1.1.2.17 2002/01/07 22:34:33 schwern Exp $
+# $Id: Straps.pm,v 1.1.2.20 2002/04/25 05:04:35 schwern Exp $
package Test::Harness::Straps;
use strict;
use vars qw($VERSION);
use Config;
-$VERSION = '0.08';
+$VERSION = '0.09';
use Test::Harness::Assert;
use Test::Harness::Iterator;
@@ -147,13 +147,14 @@
last if $self->{saw_bailout};
}
+ $totals{skip_all} = $self->{skip_all} if defined $self->{skip_all};
+
my $passed = $totals{skip_all} ||
- ($totals{max} == $totals{seen} &&
+ ($totals{max} && $totals{seen} &&
+ $totals{max} == $totals{seen} &&
$totals{max} == $totals{ok});
$totals{passing} = $passed ? 1 : 0;
- $totals{skip_all} = $self->{skip_all} if defined $self->{skip_all};
-
$self->{totals}{$name} = \%totals;
return %totals;
}
@@ -205,8 +206,14 @@
$totals->{ok}++ if $pass;
- $totals->{details}[$result{number} - 1] =
+ if( $result{number} > 100000 ) {
+ warn "Enourmous test number seen [test $result{number}]\n";
+ warn "Can't detailize, too big.\n";
+ }
+ else {
+ $totals->{details}[$result{number} - 1] =
{$self->_detailize($pass, \%result)};
+ }
# XXX handle counter mismatch
}
@@ -242,8 +249,8 @@
my %results = $strap->analyze_file($test_file);
-Like C<analyze>, but it reads from the given $test_file. It will also
-use that name for the total report.
+Like C<analyze>, but it runs the given $test_file and parses it's
+results. It will also use that name for the total report.
=cut
@@ -264,7 +271,10 @@
}
my %results = $self->analyze_fh($file, \*FILE);
- close FILE;
+ my $exit = close FILE;
+ $results{'wait'} = $?;
+ $results{'exit'} = $? / 256;
+ $results{passing} = 0 unless $? == 0;
$self->_restore_PERL5LIB();
@@ -558,6 +568,9 @@
passing true if the whole test is considered a pass
(or skipped), false if its a failure
+ exit the exit code of the test run, if from a file
+ wait the wait code of the test run, if from a file
+
max total tests which should have been run
seen total tests actually seen
skip_all if the whole test was skipped, this will
==== //depot/perl/lib/Test/Harness/t/strap-analyze.t#2 (text) ====
Index: perl/lib/Test/Harness/t/strap-analyze.t
--- perl/lib/Test/Harness/t/strap-analyze.t.~1~ Thu Apr 25 08:30:06 2002
+++ perl/lib/Test/Harness/t/strap-analyze.t Thu Apr 25 08:30:06 2002
@@ -14,7 +14,7 @@
use strict;
-use Test::More tests => 27;
+use Test::More tests => 35;
use_ok('Test::Harness::Straps');
@@ -24,6 +24,9 @@
combined => {
passing => 0,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 10,
seen => 10,
@@ -59,6 +62,9 @@
descriptive => {
passing => 1,
+ 'wait' => 0,
+ 'exit' => 0,
+
max => 5,
seen => 5,
@@ -88,6 +94,9 @@
duplicates => {
passing => 0,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 10,
seen => 11,
@@ -103,6 +112,9 @@
head_end => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 4,
seen => 4,
@@ -118,6 +130,9 @@
lone_not_bug => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 4,
seen => 4,
@@ -133,6 +148,9 @@
head_fail => {
passing => 0,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 4,
seen => 4,
@@ -150,6 +168,9 @@
simple => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 5,
seen => 5,
@@ -165,6 +186,9 @@
simple_fail => {
passing => 0,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 5,
seen => 5,
@@ -184,6 +208,9 @@
'skip' => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 5,
seen => 5,
@@ -204,6 +231,9 @@
skip_all => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 0,
seen => 0,
skip_all => 'rope',
@@ -219,6 +249,9 @@
'todo' => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 5,
seen => 5,
@@ -238,6 +271,9 @@
taint => {
passing => 1,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 1,
seen => 1,
@@ -254,6 +290,9 @@
vms_nit => {
passing => 0,
+ 'exit' => 0,
+ 'wait' => 0,
+
max => 2,
seen => 2,
@@ -265,17 +304,92 @@
details => [ { 'ok' => 0, actual_ok => 0 },
{ 'ok' => 1, actual_ok => 1 },
],
- },
+ },
+ 'die' => {
+ passing => 0,
+
+ 'exit' => 1,
+ 'wait' => 256,
+
+ max => 0,
+ seen => 0,
+
+ 'ok' => 0,
+ 'todo' => 0,
+ 'skip' => 0,
+ bonus => 0,
+
+ details => []
+ },
+
+ die_head_end => {
+ passing => 0,
+
+ 'exit' => 1,
+ 'wait' => 256,
+
+ max => 0,
+ seen => 4,
+
+ 'ok' => 4,
+ 'todo' => 0,
+ 'skip' => 0,
+ bonus => 0,
+
+ details => [ ({ 'ok' => 1, actual_ok => 1 }) x 4
+ ],
+ },
+
+ die_last_minute => {
+ passing => 0,
+
+ 'exit' => 1,
+ 'wait' => 256,
+
+ max => 4,
+ seen => 4,
+
+ 'ok' => 4,
+ 'todo' => 0,
+ 'skip' => 0,
+ bonus => 0,
+
+ details => [ ({ 'ok' => 1, actual_ok => 1 }) x 4
+ ],
+ },
+
+ bignum => {
+ passing => 0,
+
+ 'exit' => 0,
+ 'wait' => 0,
+
+ max => 2,
+ seen => 4,
+
+ 'ok' => 4,
+ 'todo' => 0,
+ 'skip' => 0,
+ bonus => 0,
+
+ details => [ { 'ok' => 1, actual_ok => 1 },
+ { 'ok' => 1, actual_ok => 1 },
+ ]
+ },
);
+$SIG{__WARN__} = sub {
+ warn @_ unless $_[0] =~ /^Enourmous test number/ ||
+ $_[0] =~ /^Can't detailize/
+};
while( my($test, $expect) = each %samples ) {
my $strap = Test::Harness::Straps->new;
my %results = $strap->analyze_file("$SAMPLE_TESTS/$test");
- is_deeply($expect->{details}, $results{details}, "$test details" );
+ is_deeply($results{details}, $expect->{details}, "$test details" );
delete $expect->{details};
delete $results{details};
- is_deeply($expect, \%results, " the rest" );
+ is_deeply(\%results, $expect, " the rest" );
}
==== //depot/perl/lib/Test/Harness/t/test-harness.t#5 (text) ====
Index: perl/lib/Test/Harness/t/test-harness.t
--- perl/lib/Test/Harness/t/test-harness.t.~1~ Thu Apr 25 08:30:06 2002
+++ perl/lib/Test/Harness/t/test-harness.t Thu Apr 25 08:30:06 2002
@@ -1,9 +1,12 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
- @INC = '../lib';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
@@ -30,41 +33,14 @@
package main;
-# Utility testing functions.
-my $test_num = 1;
-sub ok ($;$) {
- my($test, $name) = @_;
- my $okstring = '';
- $okstring = "not " unless $test;
- $okstring .= "ok $test_num";
- $okstring .= " - $name" if defined $name;
- print "$okstring\n";
- $test_num++;
-}
-
-sub eqhash {
- my($a1, $a2) = @_;
- return 0 unless keys %$a1 == keys %$a2;
+use Test::More;
- my $ok = 1;
- foreach my $k (keys %$a1) {
- $ok = $a1->{$k} eq $a2->{$k};
- last unless $ok;
- }
-
- return $ok;
-}
-
use vars qw($Total_tests %samples);
-my $loaded;
-BEGIN { $| = 1; $^W = 1; }
-END {print "not ok $test_num\n" unless $loaded;}
-print "1..$Total_tests\n";
+plan tests => $Total_tests;
use Test::Harness;
-$loaded = 1;
-ok(1, 'compile');
-######################### End of black magic.
+use_ok('Test::Harness');
+
BEGIN {
%samples = (
@@ -78,7 +54,7 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => { },
@@ -94,7 +70,7 @@
good => 0,
tests => 1,
sub_skipped => 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => {
@@ -112,7 +88,7 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => { },
@@ -128,7 +104,7 @@
good => 0,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => {
@@ -136,7 +112,7 @@
},
all_ok => 0,
},
- todo => {
+ 'todo' => {
total => {
bonus => 1,
max => 5,
@@ -146,7 +122,7 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 2,
+ 'todo' => 2,
skipped => 0,
},
failed => { },
@@ -162,13 +138,13 @@
good => 1,
tests => 1,
sub_skipped => 0,
- todo => 2,
+ 'todo' => 2,
skipped => 0,
},
failed => { },
all_ok => 1,
},
- skip => {
+ 'skip' => {
total => {
bonus => 0,
max => 5,
@@ -178,7 +154,7 @@
good => 1,
tests => 1,
sub_skipped=> 1,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => { },
@@ -195,7 +171,7 @@
good => 0,
tests => 1,
sub_skipped=> 1,
- todo => 2,
+ 'todo' => 2,
skipped => 0
},
failed => {
@@ -213,7 +189,7 @@
good => 0,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => {
@@ -231,7 +207,7 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => { },
@@ -247,7 +223,7 @@
good => 0,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => {
@@ -265,7 +241,7 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 1,
},
failed => { },
@@ -281,7 +257,7 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 4,
+ 'todo' => 4,
skipped => 0,
},
failed => { },
@@ -297,15 +273,102 @@
good => 1,
tests => 1,
sub_skipped=> 0,
- todo => 0,
+ 'todo' => 0,
skipped => 0,
},
failed => { },
all_ok => 1,
},
+
+ 'die' => {
+ total => {
+ bonus => 0,
+ max => 0,
+ 'ok' => 0,
+ files => 1,
+ bad => 1,
+ good => 0,
+ tests => 1,
+ sub_skipped=> 0,
+ 'todo' => 0,
+ skipped => 0,
+ },
+ failed => {
+ estat => 1,
+ wstat => 256,
+ max => '??',
+ failed => '??',
+ canon => '??',
+ },
+ all_ok => 0,
+ },
+
+ die_head_end => {
+ total => {
+ bonus => 0,
+ max => 0,
+ 'ok' => 4,
+ files => 1,
+ bad => 1,
+ good => 0,
+ tests => 1,
+ sub_skipped=> 0,
+ 'todo' => 0,
+ skipped => 0,
+ },
+ failed => {
+ estat => 1,
+ wstat => 256,
+ max => '??',
+ failed => '??',
+ canon => '??',
+ },
+ all_ok => 0,
+ },
+
+ die_last_minute => {
+ total => {
+ bonus => 0,
+ max => 4,
+ 'ok' => 4,
+ files => 1,
+ bad => 1,
+ good => 0,
+ tests => 1,
+ sub_skipped=> 0,
+ 'todo' => 0,
+ skipped => 0,
+ },
+ failed => {
+ estat => 1,
+ wstat => 256,
+ max => 4,
+ failed => 0,
+ canon => '??',
+ },
+ all_ok => 0,
+ },
+ bignum => {
+ total => {
+ bonus => 0,
+ max => 2,
+ 'ok' => 4,
+ files => 1,
+ bad => 1,
+ good => 0,
+ tests => 1,
+ sub_skipped=> 0,
+ 'todo' => 0,
+ skipped => 0,
+ },
+ failed => {
+ canon => '??',
+ },
+ all_ok => 0,
+ },
);
- $Total_tests = (keys(%samples) * 4);
+ $Total_tests = (keys(%samples) * 4) + 1;
}
tie *NULL, 'My::Dev::Null' or die $!;
@@ -321,21 +384,21 @@
select STDOUT;
unless( $@ ) {
- ok( Test::Harness::_all_ok($totals) == $expect->{all_ok},
+ is( Test::Harness::_all_ok($totals), $expect->{all_ok},
"$test - all ok" );
ok( defined $expect->{total}, "$test - has total" );
- ok( eqhash( $expect->{total},
- {map { $_=>$totals->{$_} } keys %{$expect->{total}}} ),
+ is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
+ $expect->{total},
"$test - totals" );
- ok( eqhash( $expect->{failed},
- {map { $_=>$failed->{"$SAMPLE_TESTS/$test"}{$_} }
- keys %{$expect->{failed}}} ),
+ is_deeply( {map { $_=>$failed->{"$SAMPLE_TESTS/$test"}{$_} }
+ keys %{$expect->{failed}}},
+ $expect->{failed},
"$test - failed" );
}
else { # special case for bailout
- ok( ($test eq 'bailout' and $@ =~ /Further testing stopped: GERONI/i),
- $test );
- ok( 1, 'skipping for bailout' );
- ok( 1, 'skipping for bailout' );
+ is( $test, 'bailout' );
+ like( $@, '/Further testing stopped: GERONI/i', $test );
+ pass( 'skipping for bailout' );
+ pass( 'skipping for bailout' );
}
}
==== //depot/perl/t/lib/sample-tests/taint#2 (text) ====
==== //depot/perl/t/lib/sample-tests/bignum#1 (text) ====
Index: perl/t/lib/sample-tests/bignum
--- perl/t/lib/sample-tests/bignum.~1~ Thu Apr 25 08:30:06 2002
+++ perl/t/lib/sample-tests/bignum Thu Apr 25 08:30:06 2002
@@ -0,0 +1,7 @@
+print <<DUMMY;
+1..2
+ok 1
+ok 2
+ok 100001
+ok 136211425
+DUMMY
==== //depot/perl/t/lib/sample-tests/die#1 (text) ====
Index: perl/t/lib/sample-tests/die
--- perl/t/lib/sample-tests/die.~1~ Thu Apr 25 08:30:06 2002
+++ perl/t/lib/sample-tests/die Thu Apr 25 08:30:06 2002
@@ -0,0 +1 @@
+exit 1; # exit because die() can be noisy
==== //depot/perl/t/lib/sample-tests/die_head_end#1 (text) ====
Index: perl/t/lib/sample-tests/die_head_end
--- perl/t/lib/sample-tests/die_head_end.~1~ Thu Apr 25 08:30:06 2002
+++ perl/t/lib/sample-tests/die_head_end Thu Apr 25 08:30:06 2002
@@ -0,0 +1,8 @@
+print <<DUMMY_TEST;
+ok 1
+ok 2
+ok 3
+ok 4
+DUMMY_TEST
+
+exit 1;
==== //depot/perl/t/lib/sample-tests/die_last_minute#1 (text) ====
Index: perl/t/lib/sample-tests/die_last_minute
--- perl/t/lib/sample-tests/die_last_minute.~1~ Thu Apr 25 08:30:06 2002
+++ perl/t/lib/sample-tests/die_last_minute Thu Apr 25 08:30:06 2002
@@ -0,0 +1,9 @@
+print <<DUMMY_TEST;
+ok 1
+ok 2
+ok 3
+ok 4
+1..4
+DUMMY_TEST
+
+exit 1;
End of Patch.