diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-06-13 19:17:50 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-06-13 19:17:50 +0000 |
commit | f02c194e1a40f11d020685cd18b41e5261091b12 (patch) | |
tree | 37863ea19d4769893b861e11cb30b0215621246d /t | |
parent | cff1be36840a17022b50a6f295ed97efe19b975e (diff) | |
download | perl-f02c194e1a40f11d020685cd18b41e5261091b12.tar.gz |
Remove the deprecated $* variable.
Incidentally, this fixes bug #22354, about unwanted
action-at-distance of the /m regexp modifier.
Add a new warning to advertise this fact.
p4raw-id: //depot/perl@19769
Diffstat (limited to 't')
-rw-r--r-- | t/lib/warnings/gv | 4 | ||||
-rwxr-xr-x | t/op/pat.t | 25 | ||||
-rwxr-xr-x | t/op/study.t | 9 |
3 files changed, 23 insertions, 15 deletions
diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index 5ed4eca018..8d2fef5601 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -9,7 +9,7 @@ fred() ; Use of $# is deprecated - Use of $* is deprecated + $* has been removed $a = ${"#"} ; $a = ${"*"} ; @@ -51,4 +51,4 @@ $a = ${"#"}; $a = ${"*"}; EXPECT Use of $# is deprecated at - line 3. -Use of $* is deprecated at - line 4. +$* has been removed at - line 4. diff --git a/t/op/pat.t b/t/op/pat.t index 006e1b600f..ccf57a17d5 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..998\n"; +print "1..1004\n"; BEGIN { chdir 't' if -d 't'; @@ -20,9 +20,8 @@ $x = "abc\ndef\n"; if ($x =~ /^abc/) {print "ok 1\n";} else {print "not ok 1\n";} if ($x !~ /^def/) {print "ok 2\n";} else {print "not ok 2\n";} -$* = 1; -if ($x =~ /^def/) {print "ok 3\n";} else {print "not ok 3\n";} -$* = 0; +# used to be a test for $* +if ($x =~ /^def/m) {print "ok 3\n";} else {print "not ok 3\n";} $_ = '123'; if (/^([0-9][0-9]*)/) {print "ok 4\n";} else {print "not ok 4\n";} @@ -69,9 +68,8 @@ if (m|bc/*d|) {print "ok 22\n";} else {print "not ok 22\n";} if (/^$_$/) {print "ok 23\n";} else {print "not ok 23\n";} -$* = 1; # test 3 only tested the optimized version--this one is for real -if ("ab\ncd\n" =~ /^cd/) {print "ok 24\n";} else {print "not ok 24\n";} -$* = 0; +# used to be a test for $* +if ("ab\ncd\n" =~ /^cd/m) {print "ok 24\n";} else {print "not ok 24\n";} $XXX{123} = 123; $XXX{234} = 234; @@ -3172,4 +3170,15 @@ ok("bbbbac" =~ /$pattern/ && $1 eq 'a', "[perl #3547]"); ok("\x{100}X" =~ /$re/, "S_cl_and ANYOF_UNICODE & ANYOF_INVERTED"); } -# last test 998 +# bug #22354 +sub func ($) { + ok( "a\nb" !~ /^b/, $_[0] ); + ok( "a\nb" =~ /^b/m, "$_[0] - with /m" ); +} +func "standalone"; +$_ = "x"; s/x/func "in subst"/e; +$_ = "x"; s/x/func "in multiline subst"/em; +#$_ = "x"; /x(?{func "in regexp"})/; +#$_ = "x"; /x(?{func "in multiline regexp"})/m; + +# last test 1004 diff --git a/t/op/study.t b/t/op/study.t index c93e4f63d2..17c59daa88 100755 --- a/t/op/study.t +++ b/t/op/study.t @@ -55,9 +55,8 @@ study($x); ok($x =~ /^abc/); ok($x !~ /^def/); -$* = 1; -ok($x =~ /^def/); -$* = 0; +# used to be a test for $* +ok($x =~ /^def/m); $_ = '123'; study; @@ -102,8 +101,8 @@ ok(m|bc/*d|); ok(/^$_$/); -$* = 1; # test 3 only tested the optimized version--this one is for real -ok("ab\ncd\n" =~ /^cd/); +# used to be a test for $* +ok("ab\ncd\n" =~ /^cd/m); if ($^O eq 'os390' or $^O eq 'posix-bc' or $^O eq 'MacOS') { # Even with the alarm() OS/390 and BS2000 can't manage these tests |