various tweaks; result passes all tests for normal build on Solaris;
[p5sagit/p5-mst-13.2.git] / t / lib / io_poll.t
CommitLineData
cf7fe8a2 1#!./perl
2
3BEGIN {
4 unless(grep /blib/, @INC) {
5 chdir 't' if -d 't';
6 @INC = '../lib' if -d '../lib';
7 }
8}
9
10select(STDERR); $| = 1;
11select(STDOUT); $| = 1;
12
13print "1..8\n";
14
15use IO::Handle;
16use IO::Poll qw(/POLL/);
17
18my $poll = new IO::Poll;
19
20my $stdout = \*STDOUT;
21my $dupout = IO::Handle->new_from_fd(fileno($stdout),"w");
22
23$poll->mask($stdout => POLLOUT);
24
25print "not "
26 unless $poll->mask($stdout) == POLLOUT;
27print "ok 1\n";
28
29$poll->mask($dupout => POLLPRI);
30
31print "not "
32 unless $poll->mask($dupout) == POLLPRI;
33print "ok 2\n";
34
35$poll->poll(0.1);
36
37print "not "
38 unless $poll->events($stdout) == POLLOUT;
39print "ok 3\n";
40
41print "not "
42 if $poll->events($dupout);
43print "ok 4\n";
44
45my @h = $poll->handles;
46print "not "
47 unless @h == 2;
48print "ok 5\n";
49
50$poll->remove($stdout);
51
52@h = $poll->handles;
53
54print "not "
55 unless @h == 1;
56print "ok 6\n";
57
58print "not "
59 if $poll->mask($stdout);
60print "ok 7\n";
61
62$poll->poll(0.1);
63
64print "not "
65 if $poll->events($stdout);
66print "ok 8\n";