3 open(TESTS,'op/re_tests') || open(TESTS,'t/op/re_tests')
4 || die "Can't open re_tests";
12 print "1..$numtests\n";
15 ($pat, $subject, $result, $repl, $expect) = split(/[\t\n]/,$_);
16 $input = join(':',$pat,$subject,$result,$repl,$expect);
17 $pat = "'$pat'" unless $pat =~ /^'/;
18 for $study ("", "study \$match") {
19 eval "$study; \$match = (\$subject =~ m$pat); \$got = \"$repl\";";
21 if ($@ eq '') { print "not ok $.\n"; next TEST }
22 last; # no need to study a syntax error
24 elsif ($result eq 'n') {
25 if ($match) { print "not ok $. $input => $got\n"; next TEST }
28 if (!$match || $got ne $expect) {
29 print "not ok $. $input => $got\n";