summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSADAHIRO Tomoyuki <BQW10602@nifty.com>2004-02-23 01:09:33 +0900
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-02-23 19:15:53 +0000
commit90f5826e78891b7633d6b153f416059ce7d36f9e (patch)
tree8a2e8b752e33f9f0850e9aa9d87122acb62ab9a2 /t
parent33e4b5a9a1796aefffe3aa9613e9ae84909ceb74 (diff)
downloadperl-90f5826e78891b7633d6b153f416059ce7d36f9e.tar.gz
Re: [perl #26905] "use bytes" doesn't apply byte semantics to concatenation
Date: Sun, 22 Feb 2004 16:09:33 +0900 Message-Id: <20040222160505.98E5.BQW10602@nifty.com> Subject: [PATCH] Encode::CN::HZ (was Re: [perl #26905] "use bytes" doesn't apply byte semantics to concatenation) From: SADAHIRO Tomoyuki <bqw10602@nifty.com> Date: Sun, 22 Feb 2004 18:41:43 +0900 Message-Id: <20040222182357.6B39.BQW10602@nifty.com> Plus, add a "_01" to the theoretical version number of Encode::CN::HZ. p4raw-id: //depot/perl@22363
Diffstat (limited to 't')
-rw-r--r--t/op/concat.t31
1 files changed, 30 insertions, 1 deletions
diff --git a/t/op/concat.t b/t/op/concat.t
index 865a498f22..5ef40dd8c1 100644
--- a/t/op/concat.t
+++ b/t/op/concat.t
@@ -18,7 +18,7 @@ sub ok {
return $ok;
}
-print "1..20\n";
+print "1..28\n";
($a, $b, $c) = qw(foo bar);
@@ -117,3 +117,32 @@ sub beq { use bytes; $_[0] eq $_[1]; }
$y = ($x = '' . strfoo()) . "y";
ok( "$x,$y" eq "x,xy", 'figures out correct target' );
}
+
+{
+ # [perl #26905] "use bytes" doesn't apply byte semantics to concatenation
+
+ my $p = "\xB6"; # PILCROW SIGN (ASCII/EBCDIC), 2bytes in UTF-X
+ my $u = "\x{100}";
+ my $b = pack 'a*', "\x{100}";
+ my $pu = "\xB6\x{100}";
+ my $up = "\x{100}\xB6";
+ my $x1 = $p;
+ my $y1 = $u;
+
+ use bytes;
+ ok(beq($p.$u, $p.$b), "perl #26905, left eq bytes");
+ ok(beq($u.$p, $b.$p), "perl #26905, right eq bytes");
+ ok(!beq($p.$u, $pu), "perl #26905, left ne unicode");
+ ok(!beq($u.$p, $up), "perl #26905, right ne unicode");
+
+ $x1 .= $u;
+ $x2 = $p . $u;
+ $y1 .= $p;
+ $y2 = $u . $p;
+
+ no bytes;
+ ok(beq($x1, $x2), "perl #26905, left, .= vs = . in bytes");
+ ok(beq($y1, $y2), "perl #26905, right, .= vs = . in bytes");
+ ok(($x1 eq $x2), "perl #26905, left, .= vs = . in chars");
+ ok(($y1 eq $y2), "perl #26905, right, .= vs = . in chars");
+}