This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Dispatch signals in infinite loops such as 1 while 1;
[perl5.git] / t / op / sigdispatch.t
CommitLineData
8f3964af
NC
1#!perl -w
2
3# We assume that TestInit has been used.
4
5BEGIN {
6 require './test.pl';
7}
8
9use strict;
10
11plan tests => 4;
12
13watchdog(10);
14
15$SIG{ALRM} = sub {
16 die "Alarm!\n";
17};
18
19pass('before the first loop');
20
21alarm 2;
22
23eval {
24 1 while 1;
25};
26
27is($@, "Alarm!\n", 'after the first loop');
28
29pass('before the second loop');
30
31alarm 2;
32
33eval {
34 while (1) {
35 }
36};
37
38is($@, "Alarm!\n", 'after the second loop');