From: M. J. T. Guy Date: Mon, 24 Jul 2000 15:32:29 +0000 (+0100) Subject: Test cases for #6431. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=815d35b97a7bc93721924c4074656996fb6da70d;p=p5sagit%2Fp5-mst-13.2.git Test cases for #6431. Subject: Re: [PATCH] [ID 20000716.011] strangeness with split($_ =~ m/.../) Message-Id: p4raw-id: //depot/perl@6432 --- diff --git a/t/op/pat.t b/t/op/pat.t index e00328c..81591fc 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 8b9f4ad..07f0098 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";