summaryrefslogtreecommitdiff
path: root/t/op.regexp
diff options
context:
space:
mode:
Diffstat (limited to 't/op.regexp')
-rw-r--r--t/op.regexp31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/op.regexp b/t/op.regexp
new file mode 100644
index 0000000000..7c97227ccc
--- /dev/null
+++ b/t/op.regexp
@@ -0,0 +1,31 @@
+#!./perl
+
+# $Header: op.regexp,v 2.0 88/06/05 00:14:27 root Exp $
+
+open(TESTS,'re_tests') || open(TESTS,'t/re_tests') || die "Can't open re_tests";
+while (<TESTS>) { }
+$numtests = $.;
+close(TESTS);
+
+print "1..$numtests\n";
+open(TESTS,'re_tests') || open(TESTS,'t/re_tests') || die "Can't open re_tests";
+while (<TESTS>) {
+ ($pat, $subject, $result, $repl, $expect) = split(/[\t\n]/,$_);
+ $input = join(':',$pat,$subject,$result,$repl,$expect);
+ eval "\$match = (\$subject =~ \$pat); \$got = \"$repl\";";
+ if ($result eq 'c') {
+ if ($@ ne '') {print "ok $.\n";} else {print "not ok $.\n";}
+ }
+ elsif ($result eq 'n') {
+ if (!$match) {print "ok $.\n";} else {print "not ok $. $input => $got\n";}
+ }
+ else {
+ if ($match && $got eq $expect) {
+ print "ok $.\n";
+ }
+ else {
+ print "not ok $. $input => $got\n";
+ }
+ }
+}
+close(TESTS);