my
$t
= Testing->new;
my
$o
= Hook::Output::Tiny->new;
{
eval
{ imgcopyright(); };
like $@,
qr/'image' argument/
,
"dies with no 'image' arg"
;
}
{
eval
{ imgcopyright(
src
=>
$t
->base); };
like $@,
qr/'name' argument/
,
"dies with no 'name' arg"
;
}
{
$o
->flush;
$o
->hook;
eval
{ imgcopyright(
src
=>
$t
->base,
check
=> 1); };
$o
->unhook;
is $@,
''
,
"doesn't die with no name with check"
;
}
{
$o
->flush;
$o
->hook;
imgcopyright(
src
=>
$t
->base,
name
=>
'steve'
,
check
=> 1);
$o
->unhook;
is
$o
->stderr, 0,
"no error output on check with no exif"
;
my
@out
=
$o
->stdout;
is
$o
->stdout, 1,
"proper warning for single img w/no exif"
;
like
$out
[0],
qr/Copyright/
,
"single w/no exif Copyright ok"
;
like
$out
[0],
qr/Creator/
,
"single w/no exif Creator ok"
;
}
{
$o
->flush;
$o
->hook;
imgcopyright(
src
=>
$t
->build,
name
=>
'steve'
,
check
=> 1);
$o
->unhook;
is
$o
->stderr, 0,
"no error output on check with no exif"
;
my
@out
=
$o
->stdout;
is
@out
, 1,
"proper warning for single img w/no exif"
;
like
$out
[0],
qr/Copyright/
,
"good/bad w/no exif Copyright ok"
;
like
$out
[0],
qr/Creator/
,
"good/bad w/no exif Creator ok"
;
}
done_testing();