diff options
Diffstat (limited to 't/uni')
-rw-r--r-- | t/uni/overload.t | 15 |
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': $!"; } |