File: 02_once.t

package info (click to toggle)
libev-perl 4.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 972 kB
  • sloc: ansic: 7,054; perl: 53; makefile: 10
file content (41 lines) | stat: -rw-r--r-- 837 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
BEGIN {
   if (exists $ENV{AUTOMATED_TESTING}) {
      print "1..0 # Skipped: Too many broken cpan tester setups.\n";
      exit;
   }
}

BEGIN { $| = 1; print "1..30\n"; }

no warnings;
use strict;
use Socket;

use EV;

for my $it ("", 1, 2) {
   for my $i (3..5) {
      EV::once undef, 0, ($i - 3) * 0.1 + 0.2, sub {
         print $_[0] == EV::TIMER ? "" : "not ", "ok $it$i\n";
      };
   }

   socketpair my $s1, my $s2, AF_UNIX, SOCK_STREAM, PF_UNSPEC;

   EV::once $s1, EV::WRITE, 0.1, sub {
      print $_[0] & EV::WRITE ? "" : "not ", "ok ${it}2\n";
   };

   print "ok ${it}1\n";
   EV::run;
   print "ok ${it}6\n";
   EV::signal INT => sub { };
   print "ok ${it}7\n";
   EV::async sub { };
   print "ok ${it}8\n";
   EV::default_destroy;
   print "ok ${it}9\n";
   EV::default_loop;
   print "ok ", ${it}*10 + 10, "\n";
}