X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04multipart.t;h=1b27ebd67668a59ddafdd9b72d4e8980ea1e1664;hb=3debb7c03ca0bf95876fec1b62ec76026cce434a;hp=1783429b7d7b5655c2f35b597d9c0bcd4f6c9c16;hpb=2759ad98dfed7d927a85b5c8b7b05e9c44aef420;p=catagits%2FHTTP-Body.git diff --git a/t/04multipart.t b/t/04multipart.t index 1783429..1b27ebd 100644 --- a/t/04multipart.t +++ b/t/04multipart.t @@ -3,13 +3,14 @@ use strict; use warnings; -use Test::More tests => 60; +use Test::More tests => 98; use Cwd; use HTTP::Body; use File::Spec::Functions; use IO::File; use YAML; +use File::Temp qw/ tempdir /; my $path = catdir( getcwd(), 't', 'data', 'multipart' ); @@ -20,6 +21,10 @@ for ( my $i = 1; $i <= 12; $i++ ) { my $results = YAML::LoadFile( catfile( $path, "$test-results.yml" ) ); my $content = IO::File->new( catfile( $path, "$test-content.dat" ) ); my $body = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} ); + my $tempdir = tempdir( 'XXXXXXX', CLEANUP => 1, DIR => File::Spec->tmpdir() ); + $body->tmpdir($tempdir); + + my $regex_tempdir = quotemeta($tempdir); binmode $content, ':raw'; @@ -35,6 +40,7 @@ for ( my $i = 1; $i <= 12; $i++ ) { my $value = $body->upload->{$field}; for ( ( ref($value) eq 'ARRAY' ) ? @{$value} : $value ) { + like($_->{tempname}, qr{$regex_tempdir}, "has tmpdir $tempdir"); push @temps, delete $_->{tempname}; } }