Skip to content

Instantly share code, notes, and snippets.

@yappo
Created July 3, 2009 08:07
Show Gist options
  • Select an option

  • Save yappo/139996 to your computer and use it in GitHub Desktop.

Select an option

Save yappo/139996 to your computer and use it in GitHub Desktop.
diff --git a/perl/t/05_preferred_int.t b/perl/t/05_preferred_int.t
index 39c725a..c9a58f2 100644
--- a/perl/t/05_preferred_int.t
+++ b/perl/t/05_preferred_int.t
@@ -11,8 +11,14 @@ sub packit {
$_;
}
-sub pis ($$) {
- is packit($_[0]), $_[1], 'dump ' . $_[1];
+sub pis_ok ($$) {
+ local $Data::MessagePack::PreferInteger = 1;
+ is packit($_[0]), $_[1], 'ok dump ' . $_[1];
+ # is(Dumper(Data::MessagePack->unpack(Data::MessagePack->pack($_[0]))), Dumper($_[0]));
+}
+sub pis_ng ($$) {
+ local $Data::MessagePack::PreferInteger = 0;
+ is packit($_[0]), $_[1], 'ng dump ' . $_[1];
# is(Dumper(Data::MessagePack->unpack(Data::MessagePack->pack($_[0]))), Dumper($_[0]));
}
@@ -38,10 +44,10 @@ my @dat = (
{'0' => '1'}, '81 00 01',
{'abc' => '1'}, '81 a3 61 62 63 01',
);
-plan tests => 1*(scalar(@dat)/2);
+plan tests => 2*(scalar(@dat)/2);
-$Data::MessagePack::PreferInteger = 1;
for (my $i=0; $i<scalar(@dat); ) {
- pis $dat[$i++], $dat[$i++];
+ pis_ok $dat[$i++], $dat[$i++];
+ pis_ng $dat[$i++], $dat[$i++];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment