#!perl
$| = 1;
BEGIN {
$ENV
{RUNALONE_DEFER_LOCK} = 1;
}
use
lib
$FindBin::Bin
.
'/..'
;
my
$run_entered
;
my
$stderr
=
''
;
{
local
$SIG
{__WARN__} =
sub
{
$stderr
.=
$_
[0]; };
}
do
{
my
$app
= __PACKAGE__->new;
$app
->run;
}
unless
caller
();
sub
run {
my
$self
=
shift
;
$run_entered
= 1;
}
exit
;
END {
ok( 1,
'in the END block'
);
is( Local::TrapExit::exit_code(), 0,
'normal exit'
);
is(
$stderr
,
''
,
'no error was on STDERR'
);
ok( __PACKAGE__->DOES(
'Role::RunAlone'
),
'role was composed'
);
my
$tag_info
= __PACKAGE__->_runalone_tag_pkg;
is(
$tag_info
->{
package
}, __PACKAGE__,
'tag was found in '
. __PACKAGE__ );
ok(
$run_entered
,
'script executed'
);
done_testing();
}