Change 13486 by jhi@alpha on 2001/12/06 14:23:06

        Subject: [PATCH] Re: counting tr thinks it's modifying 
        From: [EMAIL PROTECTED] (Rafael Garcia-Suarez)
        Date: 6 Dec 2001 11:06:01 -0000
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/op.c#458 edit
.... //depot/perl/t/op/tr.t#29 edit

Differences ...

==== //depot/perl/op.c#458 (text) ====
Index: perl/op.c
--- perl/op.c.~1~       Thu Dec  6 07:30:06 2001
+++ perl/op.c   Thu Dec  6 07:30:06 2001
@@ -2936,6 +2936,9 @@
            if (!squash)
                o->op_private |= OPpTRANS_IDENTICAL;
        }
+       else if (!squash && rlen == tlen && memEQ((char*)t, (char*)r, tlen)) {
+           o->op_private |= OPpTRANS_IDENTICAL;
+       }
        for (i = 0; i < 256; i++)
            tbl[i] = -1;
        for (i = 0, j = 0; i < tlen; i++,j++) {

==== //depot/perl/t/op/tr.t#29 (xtext) ====
Index: perl/t/op/tr.t
--- perl/t/op/tr.t.~1~  Thu Dec  6 07:30:06 2001
+++ perl/t/op/tr.t      Thu Dec  6 07:30:06 2001
@@ -5,7 +5,7 @@
     @INC = '../lib';
 }
 
-print "1..71\n";
+print "1..72\n";
 
 $_ = "abcdefghijklmnopqrstuvwxyz";
 
@@ -174,7 +174,7 @@
 print ((eval '"123" =~ tr/12//' == 2) ? '' : 'not ', "ok 28\n");
 
 # 29: test lhs bad if updating
-eval '"123" =~ tr/1/1/';
+eval '"123" =~ tr/1/2/';
 print (($@ =~ m|^Can't modify constant item in transliteration \(tr///\)|)
        ? '' : 'not ', "ok 29\n");
 
@@ -397,3 +397,7 @@
   tr/N/n/;
   print +($_ eq 'n' ? '' : "not ") . "ok 71\n";
 }
+
+# 72: counting on a constant
+$x = eval '"1213" =~ tr/1/1/';
+print $@ || $x != 2 ? "not ok 72\n" : "ok 72\n";
End of Patch.

Reply via email to