plan
skip_all
=>
'Capture::Tiny not found'
if
$@;
my
$expected_stderr
=
''
;
{
my
$rc
;
my
(
$stdout
,
$stderr
) = Capture::Tiny::capture(
sub
{
my
@cmd
= ( $^X,
'-Ilib'
,
'-MTest::PDL=eq_pdl'
,
'-e1'
);
$rc
=
system
@cmd
;
} );
cmp_ok
$rc
,
'=='
, 0,
'system() succeeded'
;
is
$stdout
,
''
,
'no output on stdout'
;
$expected_stderr
=
$stderr
;
}
{
my
$rc
;
my
(
$stdout
,
$stderr
) = Capture::Tiny::capture(
sub
{
my
@cmd
= ( $^X,
'-Ilib'
,
'-MTest::PDL=eq_pdl'
,
'-e'
,
'scalar eq_pdl(3,4)'
);
$rc
=
system
@cmd
;
} );
cmp_ok
$rc
,
'=='
, 0,
'system() succeeded'
;
is
$stdout
,
''
,
'eq_pdl() does not produce output on stdout'
;
is
$stderr
,
$expected_stderr
,
'eq_pdl() does not produce output on stderr'
;
}
{
my
$rc
;
my
(
$stdout
,
$stderr
) = Capture::Tiny::capture(
sub
{
my
@cmd
= ( $^X,
'-Ilib'
,
'-MTest::PDL=eq_pdl'
,
'-e'
,
'(eq_pdl(3,4))'
);
$rc
=
system
@cmd
;
} );
cmp_ok
$rc
,
'=='
, 0,
'system() succeeded'
;
is
$stdout
,
''
,
'eq_pdl() does not produce output on stdout in list context'
;
is
$stderr
,
$expected_stderr
,
'eq_pdl() does not produce output on stderr in list context'
;
}
done_testing;