Change 14529 by jhi@alpha on 2002/02/03 15:27:26
Subject: [PATCH t/op/taint.t] remove possible false positive
From: Rafael Garcia-Suarez <[EMAIL PROTECTED]>
Date: Sat, 2 Feb 2002 13:11:01 +0100
Message-ID: <20020202131101.A722@rafael>
Subject: [PATCH t/op/ver.t] another false positive
From: Rafael Garcia-Suarez <[EMAIL PROTECTED]>
Date: Sat, 2 Feb 2002 13:38:22 +0100
Message-ID: <20020202133822.E722@rafael>
Subject: [PATCH] t/test.pl:ok() doesn't work
From: [EMAIL PROTECTED] (Yitzchak Scott-Thoennes)
Date: Sun, 03 Feb 2002 00:02:38 -0800
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/lib/Net/t/netrc.t#6 edit
.... //depot/perl/t/op/stat.t#61 edit
.... //depot/perl/t/op/taint.t#43 edit
.... //depot/perl/t/op/ver.t#24 edit
.... //depot/perl/t/test.pl#38 edit
Differences ...
==== //depot/perl/lib/Net/t/netrc.t#6 (text) ====
Index: perl/lib/Net/t/netrc.t
--- perl/lib/Net/t/netrc.t.~1~ Sun Feb 3 08:30:06 2002
+++ perl/lib/Net/t/netrc.t Sun Feb 3 08:30:06 2002
@@ -58,7 +58,8 @@
$stat[2] = 077;
ok( !defined(Net::Netrc::_readrc()),
'_readrc() should not read world-writable file' );
- ok( $warn =~ /^Bad permissions:/, '... and should warn about it' );
+ ok( scalar( $warn =~ /^Bad permissions:/ ),
+ '... and should warn about it' );
# the owner field should still not match
$stat[2] = 0;
@@ -66,7 +67,8 @@
if ($<) {
ok( !defined(Net::Netrc::_readrc()),
'_readrc() should not read file owned by someone else' );
- ok( $warn =~ /^Not owner:/, '... and should warn about it' );
+ ok( scalar( $warn =~ /^Not owner:/ ),
+ '... and should warn about it' );
} else {
ok(1, "Skip - testing as root") for 1..2;
}
==== //depot/perl/t/op/stat.t#61 (xtext) ====
Index: perl/t/op/stat.t
--- perl/t/op/stat.t.~1~ Sun Feb 3 08:30:06 2002
+++ perl/t/op/stat.t Sun Feb 3 08:30:06 2002
@@ -336,14 +336,14 @@
ok(! -B FOO, ' !-B');
$_ = <FOO>;
- ok(/perl/, 'after readline');
+ like($_, qr/perl/, 'after readline');
ok(-T FOO, ' still -T');
ok(! -B FOO, ' still -B');
close(FOO);
open(FOO,'op/stat.t');
$_ = <FOO>;
- ok(/perl/, 'reopened and after readline');
+ like($_, qr/perl/, 'reopened and after readline');
ok(-T FOO, ' still -T');
ok(! -B FOO, ' still !-B');
==== //depot/perl/t/op/taint.t#43 (xtext) ====
Index: perl/t/op/taint.t
--- perl/t/op/taint.t.~1~ Sun Feb 3 08:30:06 2002
+++ perl/t/op/taint.t Sun Feb 3 08:30:06 2002
@@ -16,7 +16,7 @@
use Config;
my $test = 177;
-sub ok {
+sub ok ($;$) {
my($ok, $name) = @_;
# You have to do it this way or VMS will get confused.
==== //depot/perl/t/op/ver.t#24 (xtext) ====
Index: perl/t/op/ver.t
--- perl/t/op/ver.t.~1~ Sun Feb 3 08:30:06 2002
+++ perl/t/op/ver.t Sun Feb 3 08:30:06 2002
@@ -191,7 +191,7 @@
my $ip = v2004.148.0.1;
my $host;
eval { $host = gethostbyaddr($ip,Socket::AF_INET) };
- ok($@ =~ /Wide character/,"Non-bytes leak to gethostbyaddr");
+ like($@, qr/Wide character/, "Non-bytes leak to gethostbyaddr");
}
# Chapter 28, pp671
==== //depot/perl/t/test.pl#38 (text) ====
Index: perl/t/test.pl
--- perl/t/test.pl.~1~ Sun Feb 3 08:30:06 2002
+++ perl/t/test.pl Sun Feb 3 08:30:06 2002
@@ -77,6 +77,7 @@
return "at $caller[1] line $caller[2]";
}
+# DON'T use this for matches. Use like() instead.
sub ok {
my ($pass, $name, @mess) = @_;
_ok($pass, _where(), $name, @mess);
End of Patch.