# used to be a test for $*
ok $x =~ /^def/m, qq ["$x_pretty" =~ /^def/m];
- nok $x =~ /^xxx/, qq ["$x_pretty" =~ /^xxx/];
- nok $x !~ /^abc/, qq ["$x_pretty" !~ /^abc/];
+ ok(!($x =~ /^xxx/), qq ["$x_pretty" =~ /^xxx/]);
+ ok(!($x !~ /^abc/), qq ["$x_pretty" !~ /^abc/]);
ok $x =~ /def/, qq ["$x_pretty" =~ /def/];
- nok $x !~ /def/, qq ["$x_pretty" !~ /def/];
+ ok(!($x !~ /def/), qq ["$x_pretty" !~ /def/]);
ok $x !~ /.def/, qq ["$x_pretty" !~ /.def/];
- nok $x =~ /.def/, qq ["$x_pretty" =~ /.def/];
+ ok(!($x =~ /.def/), qq ["$x_pretty" =~ /.def/]);
ok $x =~ /\ndef/, qq ["$x_pretty" =~ /\\ndef/];
- nok $x !~ /\ndef/, qq ["$x_pretty" !~ /\\ndef/];
+ ok(!($x !~ /\ndef/), qq ["$x_pretty" !~ /\\ndef/]);
}
{
ok /(a*b*)(c*)/ && $1 eq 'aaabbb' && $2 eq 'ccc',
qq [\$_ = '$_'; /(a*b*)(c*)/];
ok /(a+b+c+)/ && $1 eq 'aaabbbccc', qq [\$_ = '$_'; /(a+b+c+)/];
- nok /a+b?c+/, qq [\$_ = '$_'; /a+b?c+/];
+ unlike($_, qr/a+b?c+/, qq [\$_ = '$_'; /a+b?c+/]);
$_ = 'aaabccc';
ok /a+b?c+/, qq [\$_ = '$_'; /a+b?c+/];
$_ = 'aaaccc';
ok /a*b?c*/, qq [\$_ = '$_'; /a*b?c*/];
- nok /a*b+c*/, qq [\$_ = '$_'; /a*b+c*/];
+ unlike($_, qr/a*b+c*/, qq [\$_ = '$_'; /a*b+c*/]);
$_ = 'abcdef';
ok /bcd|xyz/, qq [\$_ = '$_'; /bcd|xyz/];
our @XXX = ('ok 1','not ok 1', 'ok 2','not ok 2','not ok 3');
while ($_ = shift(@XXX)) {
- my $f = index ($_, 'not') >= 0 ? \&nok : \&ok;
+ my $e = index ($_, 'not') >= 0 ? '' : 1;
my $r = m?(.*)?;
- &$f ($r, "?(.*)?");
+ is($r, $e, "?(.*)?");
/not/ && reset;
if (/not ok 2/) {
if ($^O eq 'VMS') {
{
$_ = "a-a\nxbb";
pos = 1;
- nok m/^-.*bb/mg, '$_ = "a-a\nxbb"; m/^-.*bb/mg';
+ ok(!m/^-.*bb/mg, '$_ = "a-a\nxbb"; m/^-.*bb/mg');
}
{
$_ = "xA\n" x 500;
- nok /^\s*A/m, '$_ = "xA\n" x 500; /^\s*A/m"';
+ unlike($_, qr/^\s*A/m, '$_ = "xA\n" x 500; /^\s*A/m"');
my $text = "abc dbf";
my @res = ($text =~ /.*?(b).*?\b/g);
# in most character sets match 'i' or 'j' nor would \xce match
# 'I' or 'J', but strictly speaking these tests are here for
# the good of EBCDIC, so let's test these only there.
- nok "\x8e" !~ /[i-j]/, '"\x8e" !~ /[i-j]/';
- nok "\xce" !~ /[I-J]/, '"\xce" !~ /[I-J]/';
+ unlike("\x8e", qr/[i-j]/, '"\x8e" !~ /[i-j]/');
+ unlike("\xce", qr/[I-J]/, '"\xce" !~ /[I-J]/');
}