Mercurial > projects > dstress
comparison run/auto_04.d @ 1559:ec5e144583ea
D1 -> D2 : 1/N
author | thomask |
---|---|
date | Sun, 19 Aug 2007 19:11:54 +0000 |
parents | 6e4063f99377 |
children |
comparison
equal
deleted
inserted
replaced
1558:d40d75fcd5c5 | 1559:ec5e144583ea |
---|---|
11 | 11 |
12 int status; | 12 int status; |
13 | 13 |
14 auto class AutoClass{ | 14 auto class AutoClass{ |
15 this(){ | 15 this(){ |
16 assert(status==0); | 16 if(0 != status){ |
17 assert(0); | |
18 } | |
17 status+=2; | 19 status+=2; |
18 } | 20 } |
19 ~this(){ | 21 ~this(){ |
20 assert(status==2); | 22 if(2 != status){ |
23 assert(0); | |
24 } | |
21 status--; | 25 status--; |
22 throw new Exception("error msg"); | 26 throw new Exception("error msg"); |
23 } | 27 } |
24 } | 28 } |
25 | 29 |
27 auto AutoClass ac = new AutoClass(); | 31 auto AutoClass ac = new AutoClass(); |
28 throw new Exception("check error"); | 32 throw new Exception("check error"); |
29 } | 33 } |
30 | 34 |
31 int main(){ | 35 int main(){ |
32 assert(status==0); | 36 if(0 != status){ assert(0); } |
33 try{ | 37 try{ |
34 check(); | 38 check(); |
35 }catch{ | 39 }catch{ |
36 assert(status==1); | 40 if(1 != status){ assert(0); } |
37 status-=5; | 41 status-=5; |
38 } | 42 } |
39 | 43 |
40 if(status==-4){ | 44 if(status==-4){ |
41 return 0; | 45 return 0; |