ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/t/06_loop_once.t
(Generate patch)

Comparing EV/t/06_loop_once.t (file contents):
Revision 1.1 by root, Fri Dec 21 05:30:25 2007 UTC vs.
Revision 1.4 by root, Wed Apr 15 17:49:27 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines