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' );
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';
my $value = $body->upload->{$field};
for ( ( ref($value) eq 'ARRAY' ) ? @{$value} : $value ) {
+ like($_->{tempname}, qr{$regex_tempdir}, "has tmpdir $tempdir");
push @temps, delete $_->{tempname};
}
}