3 # $RCSfile: regexp.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:20 $
5 open(TESTS,'op/re_tests') || open(TESTS,'t/op/re_tests')
6 || die "Can't open re_tests";
11 print "1..$numtests\n";
12 open(TESTS,'op/re_tests') || open(TESTS,'t/op/re_tests')
13 || die "Can't open re_tests";
16 ($pat, $subject, $result, $repl, $expect) = split(/[\t\n]/,$_);
17 $input = join(':',$pat,$subject,$result,$repl,$expect);
18 $pat = "'$pat'" unless $pat =~ /^'/;
19 eval "\$match = (\$subject =~ m$pat); \$got = \"$repl\";";
21 if ($@ ne '') {print "ok $.\n";} else {print "not ok $.\n";}
23 elsif ($result eq 'n') {
24 if (!$match) {print "ok $.\n";} else {print "not ok $. $input => $got\n";}
27 if ($match && $got eq $expect) {
31 print "not ok $. $input => $got\n";