summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-02-24 18:44:41 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-02-24 18:44:41 +0000
commitdb79b45b3c913399aef4d2f3647453e63c4772a8 (patch)
tree8f017949a97d258ab9bf69382ed306017ae5d7f4 /t
parent8fde6460a7cb90e344d87e1652b5fa8d61c68699 (diff)
downloadperl-db79b45b3c913399aef4d2f3647453e63c4772a8.tar.gz
Patching magic from Inaba-san's keyboard: fix for [perl #8769]:
"scalar upgraded to UTF-8 as a side effect of quote-interpolation when 'use encoding' is engaged"-- wasn't actually encoding's fault. p4raw-id: //depot/perl@18764
Diffstat (limited to 't')
-rw-r--r--t/op/concat.t19
1 files changed, 18 insertions, 1 deletions
diff --git a/t/op/concat.t b/t/op/concat.t
index 4813690d6b..c1a6e23e7e 100644
--- a/t/op/concat.t
+++ b/t/op/concat.t
@@ -18,7 +18,7 @@ sub ok {
return $ok;
}
-print "1..12\n";
+print "1..18\n";
($a, $b, $c) = qw(foo bar);
@@ -87,3 +87,20 @@ ok("$c$a$c" eq "foo", "concatenate undef, fore and aft");
eval{"\x{1234}$pi"};
ok(!$@, "bug id 20001020.006, constant right");
}
+
+sub beq { use bytes; $_[0] eq $_[1]; }
+
+{
+ # concat should not upgrade its arguments.
+ my($l, $r, $c);
+
+ ($l, $r, $c) = ("\x{101}", "\x{fe}", "\x{101}\x{fe}");
+ ok(beq($l.$r, $c), "concat utf8 and byte");
+ ok(beq($l, "\x{101}"), "right not changed after concat u+b");
+ ok(beq($r, "\x{fe}"), "left not changed after concat u+b");
+
+ ($l, $r, $c) = ("\x{fe}", "\x{101}", "\x{fe}\x{101}");
+ ok(beq($l.$r, $c), "concat byte and utf8");
+ ok(beq($l, "\x{fe}"), "right not changed after concat b+u");
+ ok(beq($r, "\x{101}"), "left not changed after concat b+u");
+}