ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/t/06_loop_once.t
Revision: 1.3
Committed: Fri Nov 21 02:23:15 2008 UTC (15 years, 7 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-3_51, rel-3_53, rel-3_52
Changes since 1.2: +6 -0 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.3 BEGIN {
2     if (exists $ENV{AUTOMATED_TESTING}) {
3     print "1..0 # Skipped: Too many broken cpan tester setups.\n";
4     exit;
5     }
6     }
7 root 1.1 BEGIN { $| = 1; print "1..6\n"; }
8    
9     no warnings;
10     use strict;
11     use Socket;
12    
13     use EV;
14    
15     my $l = new EV::Loop;
16    
17     for my $i (3..5) {
18 root 1.2 $l->once (undef, 0, ($i - 3) * 0.5 + 1.0, sub {
19 root 1.1 print $_[0] == EV::TIMEOUT ? "" : "not ", "ok $i\n";
20     });
21     }
22    
23     socketpair my $s1, my $s2, AF_UNIX, SOCK_STREAM, PF_UNSPEC;
24    
25     $l->once ($s1, EV::WRITE, 0.5, sub {
26     print $_[0] & EV::WRITE ? "" : "not ", "ok 2\n";
27     });
28    
29     print "ok 1\n";
30     $l->loop;
31     print "ok 6\n";