use
5.014;
plan $] >= 5.018 ? (
skip_all
=>
'An apparent bug in Perl 5.18 makes this test always fail'
)
: (
tests
=> 8);
my
$run_sub
=
sub
{
say
"loudly ok"
};
my
$expected_text
=
"loudly ok\n"
;
my
$expected_message
=
'# Loudly'
;
my
$expected_output
=
qr/${expected_message}[.]+${expected_text}${expected_message}[.]+done/
;
my
$expected_nooutput
=
qr/${expected_message}[.]+done/
;
run_with -nocolour;
effects_ok { run
$expected_message
=>
$run_sub
; }
{
stdout
=>
$expected_output
,
};
{
run_with -nooutput;
effects_ok { run
$expected_message
=>
$run_sub
; }
{
stdout
=>
$expected_nooutput
,
};
}
effects_ok { run
$expected_message
=>
$run_sub
; }
{
stdout
=>
$expected_output
,
};
my
$opt_silent
= 1;
{
run_with -nooutput
if
$opt_silent
;
effects_ok { run
$expected_message
=>
$run_sub
}
{
stdout
=>
$expected_nooutput
,
};
}
effects_ok { run
$expected_message
=>
sub
{
say
"loudly ok"
} }
{
stdout
=>
$expected_output
,
};
{
run_with -nooutput
if
!
$opt_silent
;
effects_ok { run
$expected_message
=>
sub
{
say
"loudly ok"
} }
{
stdout
=>
$expected_output
,
};
effects_ok { run -nooutput,
$expected_message
=>
sub
{
say
"loudly ok"
} }
{
stdout
=>
$expected_nooutput
,
};
effects_ok { run
$expected_message
=>
sub
{
say
"loudly ok"
} }
{
stdout
=>
$expected_output
,
};
}