X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05urlencoded.t;h=8654b006b5471c22a64ad5aca099cdb695ffc806;hb=08160cca69ee960a312c88410dd5c5b3b376a577;hp=ef9226257d794383865efa28118fe86f58a4abc2;hpb=0a66fd2366e29e961fe3ee608a83f86068517c92;p=catagits%2FHTTP-Body.git diff --git a/t/05urlencoded.t b/t/05urlencoded.t index ef92262..8654b00 100644 --- a/t/05urlencoded.t +++ b/t/05urlencoded.t @@ -3,22 +3,25 @@ use strict; use warnings; -use Test::More tests => 16; +use FindBin; +use lib "$FindBin::Bin/lib"; + +use Test::More tests => 37; use Cwd; use Digest::MD5 qw(md5_hex); use HTTP::Body; use File::Spec::Functions; use IO::File; -use YAML; +use PAML; my $path = catdir( getcwd(), 't', 'data', 'urlencoded' ); -for ( my $i = 1; $i <= 3; $i++ ) { +for ( my $i = 1; $i <= 6; $i++ ) { my $test = sprintf( "%.3d", $i ); - my $headers = YAML::LoadFile( catfile( $path, "$test-headers.yml" ) ); - my $results = YAML::LoadFile( catfile( $path, "$test-results.yml" ) ); + my $headers = PAML::LoadFile( catfile( $path, "$test-headers.pml" ) ); + my $results = PAML::LoadFile( catfile( $path, "$test-results.pml" ) ); my $content = IO::File->new( catfile( $path, "$test-content.dat" ) ); my $body = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} ); @@ -30,6 +33,7 @@ for ( my $i = 1; $i <= 3; $i++ ) { is_deeply( $body->body, $results->{body}, "$test UrlEncoded body" ); is_deeply( $body->param, $results->{param}, "$test UrlEncoded param" ); + is_deeply( $body->param_order, $results->{param_order} ? $results->{param_order} : [], "$test UrlEncoded param_order" ); is_deeply( $body->upload, $results->{upload}, "$test UrlEncoded upload" ); cmp_ok( $body->state, 'eq', 'done', "$test UrlEncoded state" ); cmp_ok( $body->length, '==', $body->content_length, "$test UrlEncoded length" ); @@ -37,6 +41,7 @@ for ( my $i = 1; $i <= 3; $i++ ) { # Check trailing header on the chunked request if ( $i == 3 ) { my $content = IO::File->new( catfile( $path, "002-content.dat" ) ); + binmode $content; $content->read( my $buf, 4096 ); is( $body->trailing_headers->header('Content-MD5'), md5_hex($buf), "$test trailing header ok" ); }