From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
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 <rgarciasuarez@free.fr>
Date: Sat, 2 Feb 2002 13:38:22 +0100
Message-ID: <
20020202133822.E722@rafael>
Subject: [PATCH] t/test.pl:ok() doesn't work
From: sthoenna@efn.org (Yitzchak Scott-Thoennes)
Date: Sun, 03 Feb 2002 00:02:38 -0800
Message-ID: <e6OX8gzkgSMO092yn@efn.org>
p4raw-id: //depot/perl@14529
$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;
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;
}
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');
use Config;
my $test = 177;
-sub ok {
+sub ok ($;$) {
my($ok, $name) = @_;
# You have to do it this way or VMS will get confused.
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
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);