File: hook.t

package info (click to toggle)
libevent-perl 1.15-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 792 kB
  • sloc: ansic: 3,034; perl: 1,128; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 344 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# hook -*-perl-*-

use strict;
use Test; plan test => 4;
use Event qw(sweep sleep);

my ($p,$c,$ac,$cb) = (0)x4;

Event::add_hooks(prepare => sub { ++$p },
		 check => sub { ++$c },
		 asynccheck => sub { ++$ac },
		 callback => sub { ++$cb });
Event->timer(after => 0, cb => sub {});

sleep .5;
sweep();

ok $p,1;
ok $c,1;
ok $ac,1;
ok $cb,1;