summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/lib/Test.pm
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/lib/Test.pm')
-rw-r--r--contrib/perl5/lib/Test.pm20
1 files changed, 13 insertions, 7 deletions
diff --git a/contrib/perl5/lib/Test.pm b/contrib/perl5/lib/Test.pm
index 7a0e59b..c708f57 100644
--- a/contrib/perl5/lib/Test.pm
+++ b/contrib/perl5/lib/Test.pm
@@ -1,10 +1,11 @@
use strict;
package Test;
+use 5.005_64;
use Test::Harness 1.1601 ();
use Carp;
-use vars (qw($VERSION @ISA @EXPORT @EXPORT_OK $ntest $TestLevel), #public-ish
- qw($TESTOUT $ONFAIL %todo %history $planned @FAILDETAIL)); #private-ish
-$VERSION = '1.122';
+our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $ntest, $TestLevel); #public-ish
+our($TESTOUT, $ONFAIL, %todo, %history, $planned, @FAILDETAIL); #private-ish
+$VERSION = '1.13';
require Exporter;
@ISA=('Exporter');
@EXPORT=qw(&plan &ok &skip);
@@ -63,7 +64,11 @@ sub ok ($;$$) {
} else {
$expected = to_value(shift);
my ($regex,$ignore);
- if ((ref($expected)||'') eq 'Regexp') {
+ if (!defined $expected) {
+ $ok = !defined $result;
+ } elsif (!defined $result) {
+ $ok = 0;
+ } elsif ((ref($expected)||'') eq 'Regexp') {
$ok = $result =~ /$expected/;
} elsif (($regex) = ($expected =~ m,^ / (.+) / $,sx) or
($ignore, $regex) = ($expected =~ m,^ m([^\w\s]) (.+) \1 $,sx)) {
@@ -94,7 +99,8 @@ sub ok ($;$$) {
}
} else {
my $prefix = "Test $ntest";
- print $TESTOUT "# $prefix got: '$result' ($context)\n";
+ print $TESTOUT "# $prefix got: ".
+ (defined $result? "'$result'":'<UNDEF>')." ($context)\n";
$prefix = ' ' x (length($prefix) - 5);
if ((ref($expected)||'') eq 'Regexp') {
$expected = 'qr/'.$expected.'/'
@@ -220,7 +226,7 @@ triggered at the end of a test run. C<onfail> is passed an array ref
of hash refs that describe each test failure. Each hash will contain
at least the following fields: C<package>, C<repetition>, and
C<result>. (The file, line, and test number are not included because
-their correspondance to a particular test is tenuous.) If the test
+their correspondence to a particular test is tenuous.) If the test
had an expected value or a diagnostic string, these will also be
included.
@@ -239,7 +245,7 @@ L<Test::Harness> and, perhaps, test coverage analysis tools.
=head1 AUTHOR
-Copyright (c) 1998 Joshua Nathaniel Pritikin. All rights reserved.
+Copyright (c) 1998-1999 Joshua Nathaniel Pritikin. All rights reserved.
This package is free software and is provided "as is" without express
or implied warranty. It may be used, redistributed and/or modified
OpenPOWER on IntegriCloud