use
5.010;
if
(!-t
*STDIN
|| !-t
*STDERR
) {
plan(
'skip_all'
=>
'Non-interactive test environment'
);
}
else
{
plan(
'no_plan'
);
}
my
$output
;
open
my
$out_fh
,
'>'
, \
$output
;
my
$start_time
;
if
(prompt
q{}
, -verbatim,
-timeout
=>1.5,
-out
=>
$out_fh
) {
fail
'Time-out of -timeout=>1.5'
;
}
else
{
pass
'Time-out of -timeout=>1.5'
;
}
if
(prompt
q{}
, -verbatim,
-timeout
=>0,
-out
=>
$out_fh
) {
fail
'Time-out of -timeout=>0'
;
}
else
{
pass
'Time-out of -timeout=>0'
;
}
if
(prompt
q{}
, -verbatim, -t1,
-out
=>
$out_fh
) {
fail
'Time-out of -t1'
;
}
else
{
pass
'Time-out of -t1'
;
}
if
(prompt
q{}
, -verbatim, -t0,
-out
=>
$out_fh
) {
fail
'Time-out of -t0'
;
}
else
{
pass
'Time-out of -t0'
;
}
if
(prompt
q{}
, -t0,
-in
=>
*DATA
,
-out
=>
$out_fh
) {
pass
'Non-time-out of -t0'
;
is
$_
,
'Data line 1'
=>
'Correct input'
;
}
else
{
fail
'Non-time-out of -t0'
;
}
my
$pseudofile
=
"Pseudofile line 1\n"
;
open
my
$fh
,
'<'
, \
$pseudofile
or
die
$!;
if
(prompt
q{}
, -t0,
-in
=>
$fh
,
-out
=>
$out_fh
) {
pass
'Non-time-out of -t0'
;
is
$_
,
'Pseudofile line 1'
=>
'Correct input'
;
}
else
{
fail
'Non-time-out of -t0'
;
}