summaryrefslogtreecommitdiff
path: root/t/op/sigdispatch.t
blob: 5d9908e6edd3f8fa39697896653bbb4230ba143d (plain)
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
#!perl -w

# We assume that TestInit has been used.

BEGIN {
      require './test.pl';
}

use strict;

plan tests => 4;

watchdog(10);

$SIG{ALRM} = sub {
    die "Alarm!\n";
};

pass('before the first loop');

alarm 2;

eval {
    1 while 1;
};

is($@, "Alarm!\n", 'after the first loop');

pass('before the second loop');

alarm 2;

eval {
    while (1) {
    }
};

is($@, "Alarm!\n", 'after the second loop');