Skip to content

Commit

Permalink
空objectのテストを追加。write_u24の処理が違っていたのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
typester committed Aug 14, 2008
1 parent 15d7ca1 commit a2bf203
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/Data/AMF/IO.pm
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ sub write_s16 {
sub write_u24 {
my ($self, $data) = @_;

return $self->write( pack('CCC', $data) ) if ENDIAN eq 'BIG';
return $self->write( swap pack('CCC', $data) );
$data = pack('N', $data);
$data = substr $data, 1, 3;

$self->write($data);
}

sub write_u32 {
Expand Down
6 changes: 5 additions & 1 deletion t/01_parse_amf0.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use File::Spec;

use Data::AMF;


my $amf = Data::AMF->new( version => 0 );

sub load {
Expand Down Expand Up @@ -70,6 +69,11 @@ data:
hash:
foo: bar
=== null object
--- input: data/amf0/null_object
--- expected
data: {}
=== null
--- input: data/amf0/null
--- expected
Expand Down
4 changes: 4 additions & 0 deletions t/02_format_amf0.t → t/02_format_amf0_simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ data: foo
data:
foo: bar
=== null object
--- input
data: {}
=== object2
--- input
data:
Expand Down

0 comments on commit a2bf203

Please sign in to comment.