summaryrefslogtreecommitdiff
path: root/perl/t
diff options
context:
space:
mode:
authorFuji, Goro <gfuji@cpan.org>2010-10-06 17:52:32 +0900
committerFuji, Goro <gfuji@cpan.org>2010-10-06 17:52:32 +0900
commit77a7d3d26aaf957c4f231fdc2090d1b8e842e78c (patch)
tree8a859e96671a2158370158d8105167c968d579ce /perl/t
parent4321b80999696a6d4e5340fec8f729e11c0ada06 (diff)
downloadmsgpack-python-77a7d3d26aaf957c4f231fdc2090d1b8e842e78c.tar.gz
perl: Fix utf8 mode not to be reseted by $unpacker->reset method
Diffstat (limited to 'perl/t')
-rw-r--r--perl/t/15_utf8.t32
1 files changed, 19 insertions, 13 deletions
diff --git a/perl/t/15_utf8.t b/perl/t/15_utf8.t
index d7d17b8..f3163df 100644
--- a/perl/t/15_utf8.t
+++ b/perl/t/15_utf8.t
@@ -5,23 +5,29 @@ use Data::MessagePack;
use utf8;
my $data = [42, undef, 'foo', "\x{99f1}\x{99dd}"];
-my $packed = Data::MessagePack->pack($data);
+my $packed = Data::MessagePack->pack($data) x 2;
my $u = Data::MessagePack::Unpacker->new()->utf8();
-ok $u->get_utf8();
-$u->execute($packed);
-my $d = $u->data();
-$u->reset();
-is_deeply $d, $data, 'decoded';
+my $p = 0;
+for(1 .. 2) {
+ ok $u->get_utf8();
+ $p = $u->execute($packed, $p);
+ my $d = $u->data();
+ $u->reset();
+ is_deeply $d, $data, 'decoded';
+}
is $u->utf8(0), $u, 'utf8(0)';
-ok !$u->get_utf8();
-$u->execute($packed);
-$d = $u->data();
-$u->reset();
-my $s = $data->[3];
-utf8::encode($s);
-is_deeply $d->[3], $s, 'not decoded';
+$p = 0;
+for(1 .. 2) {
+ ok !$u->get_utf8();
+ $p = $u->execute($packed, $p);
+ my $d = $u->data();
+ $u->reset();
+ my $s = $data->[3];
+ utf8::encode($s);
+ is_deeply $d->[3], $s, 'not decoded';
+}
done_testing;