diff options
author | PSYC <psyc@lectern.tobij.de> | 2009-04-06 15:36:55 +0200 |
---|---|---|
committer | PSYC <psyc@lectern.tobij.de> | 2009-04-06 15:36:55 +0200 |
commit | 2cbbcd317182fe962719027e860703c24901d891 (patch) | |
tree | 0d3a4722c1584a67d505a653604016830c6a3368 /test/timeout2.t | |
download | perlpsyc-2cbbcd317182fe962719027e860703c24901d891.tar.gz perlpsyc-2cbbcd317182fe962719027e860703c24901d891.zip |
perlPSYC-0.26.zip
Diffstat (limited to 'test/timeout2.t')
-rw-r--r-- | test/timeout2.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/timeout2.t b/test/timeout2.t new file mode 100644 index 0000000..fd2026f --- /dev/null +++ b/test/timeout2.t | |||
@@ -0,0 +1,36 @@ | |||
1 | # vim:syntax=perl | ||
2 | #!/usr/bin/perl -w | ||
3 | |||
4 | use strict; | ||
5 | BEGIN { | ||
6 | unless (eval "require Event") { | ||
7 | print "You don't have Event.pm installed. No Problem.\nSkipping this test.\n"; | ||
8 | exit; | ||
9 | } | ||
10 | require Test::Simple; | ||
11 | import Test::Simple qw(tests 1); | ||
12 | require Time::HiRes; | ||
13 | import Time::HiRes qw(gettimeofday tv_interval); | ||
14 | require Net::PSYC; | ||
15 | import Net::PSYC qw(Event=Event); | ||
16 | } | ||
17 | |||
18 | my $c = 0; | ||
19 | my ($s1, $m1, $f); | ||
20 | |||
21 | sub t { | ||
22 | $c++; | ||
23 | |||
24 | if ($c == 3) { | ||
25 | ok(1, 'Timeout events with Event.'); | ||
26 | stop_loop(); | ||
27 | } | ||
28 | |||
29 | 1; | ||
30 | } | ||
31 | |||
32 | add(1, 'i', \&t); | ||
33 | print "!\tIf nothing happens for more than 5 seconds,\n!\tterminate the test and report the failure!\n"; | ||
34 | start_loop(); | ||
35 | |||
36 | __END__ | ||