Permalink
Browse files

added tests for pack and unpack. Fixed a bug in pack

  • Loading branch information...
1 parent 02ccad0 commit 5b51c3057aa5cf3521616b60d0076881304f6ff6 @brunoV brunoV committed Mar 6, 2010
Showing with 16 additions and 1 deletion.
  1. +1 −1 Core.pm
  2. +8 −0 t/pack.t
  3. +7 −0 t/unpack.t
View
@@ -651,7 +651,7 @@ sub lc ($) { CORE::lc($_[0]); }
sub lcfirst ($) { CORE::lcfirst($_[0]); }
sub length ($) { CORE::length($_[0]); }
sub ord ($) { CORE::ord($_[0]); }
-sub pack ($;@) { CORE::pack(@_); }
+sub pack ($;@) { CORE::pack(shift, @_); }
sub reverse ($) { CORE::reverse($_[0]); }
sub rindex ($@) {
View
@@ -0,0 +1,8 @@
+use Test::More qw(no_plan);
+use strict;
+use warnings;
+
+use autobox::Core;
+
+is 'nN'->pack(42, 4711), pack('nN', 42, 4711);
+is '(sl)<'->pack(-42, 4711), pack('(sl)<', -42, 4711);
View
@@ -0,0 +1,7 @@
+use Test::More qw(no_plan);
+use strict;
+use warnings;
+
+use autobox::Core;
+
+is 'W'->unpack("foo"), unpack('W', "foo");

0 comments on commit 5b51c30

Please sign in to comment.