Created
July 3, 2009 08:10
-
-
Save yappo/139998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/perl/t/05_preferred_int.t b/perl/t/05_preferred_int.t | |
| index 39c725a..a2c4b25 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; | |
| + isnt packit($_[0]), $_[1], 'ng dump ' . $_[1]; | |
| # is(Dumper(Data::MessagePack->unpack(Data::MessagePack->pack($_[0]))), Dumper($_[0])); | |
| } | |
| @@ -38,10 +44,11 @@ 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++]; | |
| + my($x, $y) = ($i++, $i++); | |
| + pis_ok $dat[$x], $dat[$y]; | |
| + pis_ng $dat[$x], $dat[$y]; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment