summaryrefslogtreecommitdiff
path: root/t/op/subst.t
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-02-07 12:25:22 -0500
committerGurusamy Sarathy <gsar@cpan.org>1999-02-07 23:38:47 +0000
commitf5c9036e8e34a1c3af842cea81cf0efef683a2b8 (patch)
treed2bac90a8ac6f2d0fec0f741a5f8a10063f068a7 /t/op/subst.t
parente60df1faf6a2408e6441d757a835423e1efdcc95 (diff)
downloadperl-f5c9036e8e34a1c3af842cea81cf0efef683a2b8.tar.gz
s/\ba/./g was over-optimized
Message-ID: <19990207172522.B894@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@2828
Diffstat (limited to 't/op/subst.t')
-rwxr-xr-xt/op/subst.t98
1 files changed, 7 insertions, 91 deletions
diff --git a/t/op/subst.t b/t/op/subst.t
index 6776a1e59b..bfca868e4d 100755
--- a/t/op/subst.t
+++ b/t/op/subst.t
@@ -6,7 +6,7 @@ BEGIN {
require Config; import Config;
}
-print "1..93\n";
+print "1..82\n";
$x = 'foo';
$_ = "x";
@@ -312,7 +312,7 @@ s{ \d+ \b [,.;]? (?{ 'digits' })
print ($_ eq $foo ? "ok 70\n" : "not ok 70\n#'$_'\n#'$foo'\n");
$_ = 'x' x 20;
-s/\d*|x/<$&>/g;
+s/(\d*|x)/<$1>/g;
$foo = '<>' . ('<x><>' x 20) ;
print ($_ eq $foo ? "ok 71\n" : "not ok 71\n#'$_'\n#'$foo'\n");
@@ -362,98 +362,14 @@ s/\Ga/x/;
print "not " unless $_ eq 'xaaaaaaaa';
print "ok 79\n";
-$t = 'aaa';
-
-$_ = $t;
-@res = ();
-pos = 1;
-s/\Ga(?{push @res, $_, $`})/xx/g;
-print "not " unless "$_ @res" eq 'axxxx aaa a aaa aa';
+$_ = 'aaaa';
+s/\ba/./g;
+print "#'$_'\nnot " unless $_ eq '.aaa';
print "ok 80\n";
-$_ = $t;
-@res = ();
-pos = 1;
-s/\Ga(?{push @res, $_, $`})/x/g;
-print "not " unless "$_ @res" eq 'axx aaa a aaa aa';
-print "ok 81\n";
-
-$_ = $t;
-@res = ();
-pos = 1;
-s/\Ga(?{push @res, $_, $`})/xx/;
-print "not " unless "$_ @res" eq 'axxa aaa a';
-print "ok 82\n";
-
-$_ = $t;
-@res = ();
-pos = 1;
-s/\Ga(?{push @res, $_, $`})/x/;
-print "not " unless "$_ @res" eq 'axa aaa a';
-print "ok 83\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/xx/g;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axxxx aaa a aaa aa';
-print "ok 84\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/x/g;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axx aaa a aaa aa';
-print "ok 85\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/xx/;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axxa aaa a';
-print "ok 86\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/x/;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axa aaa a';
-print "ok 87\n";
-
-sub x2 {'xx'}
-sub x1 {'x'}
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/x2/ge;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axxxx aaa a aaa aa';
-print "ok 88\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/x1/ge;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axx aaa a aaa aa';
-print "ok 89\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/x2/e;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axxa aaa a';
-print "ok 90\n";
-
-$a = $t;
-@res = ();
-pos ($a) = 1;
-$a =~ s/\Ga(?{push @res, $_, $`})/x1/e;
-print "#'$a' '@res'\nnot " unless "$a @res" eq 'axa aaa a';
-print "ok 91\n";
-
eval q% s/a/"b"}/e %;
-print ($@ =~ /Bad evalled substitution/ ? "ok 92\n" : "not ok 92\n");
+print ($@ =~ /Bad evalled substitution/ ? "ok 81\n" : "not ok 81\n");
eval q% ($_ = "x") =~ s/(.)/"$1 "/e %;
-print +($_ eq "x " and !length $@) ? "ok 93\n" : "not ok 93\n# \$_ eq $_, $@\n";
+print +($_ eq "x " and !length $@) ? "ok 82\n" : "not ok 82\n# \$_ eq $_, $@\n";