BEGIN { $| = 1;
print
"1..12\n"
; }
END {
print
"not ok 1\n"
unless
$loaded
;}
$loaded
= 1;
print
"ok 1\n"
;
my
$i
= 2;
sub
success (&) {
eval
{
$_
[0]->() };
print
($@ ?
"not ok $i\n"
:
"ok $i\n"
);
$i
++; }
sub
failure (&) {
eval
{
$_
[0]->() };
print
($@ ?
"ok $i\n"
:
"not ok $i\n"
);
$i
++; }
my
$ioh
= new IO::Handle;
success {
my
$r
= new IO::React(
$ioh
);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_wait(0);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_wait(30);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_wait(
undef
);
};
failure {
my
$r
= new IO::React(
$ioh
);
$r
->set_wait(
"invalid"
);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_timeout(
sub
{});
};
failure {
my
$r
= new IO::React(
$ioh
);
$r
->set_timeout(1);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_eof(
sub
{});
};
failure {
my
$r
= new IO::React(
$ioh
);
$r
->set_eof(1);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_display(0);
};
success {
my
$r
= new IO::React(
$ioh
);
$r
->set_display(1);
};