ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Guard/t/03_die.t
Revision: 1.2
Committed: Sat Dec 13 19:43:27 2008 UTC (15 years, 5 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-1_02, rel-1_0, rel-1_021, rel-1_023, rel-1_022, rel-0_5, rel-1_01, HEAD
Changes since 1.1: +26 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.2 BEGIN { $| = 1; print "1..11\n"; }
2 root 1.1
3     use Guard;
4    
5     print "ok 1\n";
6    
7     $Guard::DIED = sub {
8     print $@ =~ /^x1 at / ? "" : "not ", "ok 3 # $@\n";
9     };
10    
11     eval {
12     scope_guard { die "x1" };
13     print "ok 2\n";
14     };
15    
16     print $@ ? "not " : "", "ok 4 # $@\n";
17    
18     $Guard::DIED = sub {
19     print $@ =~ /^x2 at / ? "" : "not ", "ok 6 # $@\n";
20     };
21    
22     eval {
23     scope_guard { die "x2" };
24     print "ok 5\n";
25     die "x3";
26     };
27    
28     print $@ =~ /^x3 at /s ? "" : "not ", "ok 7 # $@\n";
29    
30 root 1.2 our $x4 = 1;
31    
32     $SIG{__DIE__} = sub {
33     if ($x4) {
34     print "not ok 9\n";
35     } else {
36     print $_[0] =~ /^x5 at / ? "" : "not ", "ok 11 # $_[0]\n";
37     }
38     exit 0;
39     };
40    
41     {
42     $Guard::DIED = sub {
43     print $@ =~ /^x4 at / ? "" : "not ", "ok 9 # $@\n";
44     };
45    
46     scope_guard { die "x4" };
47     print "ok 8\n";
48     };
49    
50     $x4 = 0;
51     print "ok 10\n";
52    
53     die "x5";
54