summaryrefslogtreecommitdiff
path: root/t/uni
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-30 19:07:43 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-30 19:07:43 +0000
commit12abf4f0efbd7338e12bce75e8fe77c524383458 (patch)
treeb227b0a3d34e63fbd7b0db037981d2e51e7efdbf /t/uni
parentc2955298f73609931e7742722d6cdab7cad91e16 (diff)
downloadperl-12abf4f0efbd7338e12bce75e8fe77c524383458.tar.gz
do_vop() couldn't correctly handle surprises from UTF-8 overloading.
p4raw-id: //depot/perl@28029
Diffstat (limited to 't/uni')
-rw-r--r--t/uni/overload.t15
1 files changed, 13 insertions, 2 deletions
diff --git a/t/uni/overload.t b/t/uni/overload.t
index ef61667448..ca63b44a27 100644
--- a/t/uni/overload.t
+++ b/t/uni/overload.t
@@ -7,12 +7,12 @@ BEGIN {
}
}
-use Test::More tests => 190;
+use Test::More tests => 202;
package UTF8Toggle;
use strict;
-use overload '""' => 'stringify';
+use overload '""' => 'stringify', fallback => 1;
sub new {
my $class = shift;
@@ -243,6 +243,17 @@ foreach my $b ($big, UTF8Toggle->new($big)) {
}
}
+my $bits = "\311";
+foreach my $pieces ($bits, UTF8Toggle->new($bits)) {
+ like ($bits ^ $pieces, qr/\A\0+\z/, "something xor itself is zeros");
+ like ($bits ^ $pieces, qr/\A\0+\z/, "something xor itself is zeros");
+ like ($bits ^ $pieces, qr/\A\0+\z/, "something xor itself is zeros");
+
+ like ($pieces ^ $bits, qr/\A\0+\z/, "something xor itself is zeros");
+ like ($pieces ^ $bits, qr/\A\0+\z/, "something xor itself is zeros");
+ like ($pieces ^ $bits, qr/\A\0+\z/, "something xor itself is zeros");
+}
+
END {
1 while -f $tmpfile and unlink $tmpfile || die "unlink '$tmpfile': $!";
}