#!/usr/bin/perl
BEGIN
{
our
$DEBUG
=
exists
(
$ENV
{AUTHOR_TESTING} ) ?
$ENV
{AUTHOR_TESTING} : 0;
};
BEGIN
{
use
ok(
'HTTP::Promise::Parser'
);
};
my
$dir
= file(
'./t/testout'
);
bail_out(
"No output directory $dir"
)
if
( !
$dir
->is_dir || !
$dir
->can_write );
$_
->
unlink
for
(
$dir
->
glob
(
'[a-z]*'
) );
my
$dir_in
= file(
'./t/testin'
);
bail_out(
"No input directory $dir_in"
)
if
( !
$dir
->is_dir || !
$dir
->can_read );
my
$parser
= HTTP::Promise::Parser->new(
debug
=>
$DEBUG
);
$parser
->output_dir(
$dir
);
my
$f1
=
$dir_in
->child(
'multi-nested.msg'
);
my
$fh
=
$f1
->
open
(
'<'
) || bail_out(
$f1
->error );
my
$ent
=
$parser
->parse(
$fh
);
diag(
"Error parsing file $f1: "
,
$parser
->error )
if
(
$DEBUG
&& !
defined
(
$ent
) );
isa_ok(
$ent
=> [
'HTTP::Promise::Entity'
],
'Parse of nested multipart'
);
done_testing();