summaryrefslogtreecommitdiff
path: root/t/op/regexp.t
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-03-21 00:00:00 +0000
committerLarry Wall <lwall@netlabs.com>1991-03-21 00:00:00 +0000
commitfe14fcc35f78a371a174a1d14256c2f35ae4262b (patch)
treed472cb1055c47b9701cb0840969aacdbdbc9354a /t/op/regexp.t
parent27e2fb84680b9cc1db17238d5bf10b97626f477f (diff)
downloadperl-fe14fcc35f78a371a174a1d14256c2f35ae4262b.tar.gz
perl 4.0.00: (no release announcement available)perl-4.0.00
So far, 4.0 is still a beta test version. For the last production version, look in pub/perl.3.0/kits@44.
Diffstat (limited to 't/op/regexp.t')
-rw-r--r--t/op/regexp.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/op/regexp.t b/t/op/regexp.t
new file mode 100644
index 0000000000..92f084a7f0
--- /dev/null
+++ b/t/op/regexp.t
@@ -0,0 +1,33 @@
+#!./perl
+
+# $Header: regexp.t,v 4.0 91/03/20 01:54:22 lwall Locked $
+
+open(TESTS,'op/re_tests') || open(TESTS,'t/op/re_tests')
+ || die "Can't open re_tests";
+while (<TESTS>) { }
+$numtests = $.;
+close(TESTS);
+
+print "1..$numtests\n";
+open(TESTS,'op/re_tests') || open(TESTS,'t/op/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);