summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM. J. T. Guy <mjtg@cus.cam.ac.uk>2000-07-24 16:32:29 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2000-07-24 17:44:44 +0000
commit815d35b97a7bc93721924c4074656996fb6da70d (patch)
tree6c1ceb7624369698e25909114a0ba61464224297
parentde4bf5b3f25740f501dafc07bf0bdefe01434583 (diff)
downloadperl-815d35b97a7bc93721924c4074656996fb6da70d.tar.gz
Test cases for #6431.
Subject: Re: [PATCH] [ID 20000716.011] strangeness with split($_ =~ m/.../) Message-Id: <E13GjHR-00058t-00@libra.cus.cam.ac.uk> p4raw-id: //depot/perl@6432
-rwxr-xr-xt/op/pat.t11
-rwxr-xr-xt/op/split.t6
2 files changed, 15 insertions, 2 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index e00328c91f..81591fc71b 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -4,7 +4,7 @@
# the format supported by op/regexp.t. If you want to add a test
# that does fit that format, add it to op/re_tests, not here.
-print "1..213\n";
+print "1..215\n";
BEGIN {
chdir 't' if -d 't';
@@ -1012,3 +1012,12 @@ EOE
$a and $a =~ /^Object\sS/ or print "# '$a' \nnot ";
print "ok $test\n";
$test++;
+
+# test result of match used as match (!)
+'a1b' =~ ('xyz' =~ /y/) and $` eq 'a' or print "not ";
+print "ok $test\n";
+$test++;
+
+'a1b' =~ ('xyz' =~ /t/) and $` eq 'a' or print "not ";
+print "ok $test\n";
+$test++;
diff --git a/t/op/split.t b/t/op/split.t
index 8b9f4ad2f9..07f0098dbd 100755
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -2,7 +2,7 @@
# $RCSfile: split.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:26 $
-print "1..25\n";
+print "1..26\n";
$FS = ':';
@@ -109,3 +109,7 @@ print $_ eq "aa b |\naa d |" ? "ok 24\n" : "not ok 24\n# `$_'\n";
$_ = "a : b :c: d";
@ary = split(/\s*:\s*/);
if (($res = join(".",@ary)) eq "a.b.c.d") {print "ok 25\n";} else {print "not ok 25\n# res=`$res' != `a.b.c.d'\n";}
+
+# use of match result as pattern (!)
+'p:q:r:s' eq join ':', split('abc' =~ /b/, 'p1q1r1s') or print "no ";
+print "ok 26\n";