Mercurial > projects > dstress
annotate run/t/throw_07_A.d @ 1613:70a23cb6a616
Fix incorrect run.t.throw_07_A/B tests
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 10 May 2009 12:10:34 +0200 |
parents | b8c0195059d9 |
children |
rev | line source |
---|---|
1025 | 1 // $HeadURL$ |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 // @author@ <mclysenk@mtu.edu> | |
6 // @date@ 2006-05-11 | |
1489 | 7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=7180 |
1025 | 8 |
1613
70a23cb6a616
Fix incorrect run.t.throw_07_A/B tests
Christian Kamm <kamm incasoftware de>
parents:
1489
diff
changeset
|
9 module dstress.run.t.throw_07_A; |
1025 | 10 |
11 int status; | |
12 | |
13 class XException : Exception{ | |
14 this(char[] msg){ | |
15 super(msg); | |
16 } | |
17 } | |
18 | |
19 class Tester{ | |
20 this(void delegate() dg_){ | |
21 if(status++ != 0){ | |
22 assert(0); | |
23 } | |
24 dg = dg_; | |
25 } | |
26 | |
27 void delegate() dg; | |
28 | |
29 void test() { | |
30 if(status++ != 1){ | |
31 assert(0); | |
32 } | |
33 dg(); | |
34 | |
35 assert(0); | |
36 } | |
37 } | |
38 | |
39 int main(){ | |
40 void foo(){ | |
41 try{ | |
42 if(status++ != 2){ | |
43 assert(0); | |
44 } | |
45 throw new XException("test2"); | |
46 | |
47 assert(0); | |
48 }catch(XException e){ | |
49 if(status++ != 3){ | |
50 assert(0); | |
51 } | |
52 throw e; | |
53 assert(0); | |
54 }finally{ | |
55 if(status++ != 4){ | |
56 assert(0); | |
57 } | |
58 } | |
59 assert(0); | |
60 } | |
61 | |
62 Tester t = new Tester(&foo); | |
63 | |
64 try{ | |
1613
70a23cb6a616
Fix incorrect run.t.throw_07_A/B tests
Christian Kamm <kamm incasoftware de>
parents:
1489
diff
changeset
|
65 // status == 1 |
1025 | 66 t.test(); |
67 assert(0); | |
68 }catch(XException e){ | |
1613
70a23cb6a616
Fix incorrect run.t.throw_07_A/B tests
Christian Kamm <kamm incasoftware de>
parents:
1489
diff
changeset
|
69 if(status++ != 5){ |
1025 | 70 assert(0); |
71 } | |
72 }finally{ | |
1613
70a23cb6a616
Fix incorrect run.t.throw_07_A/B tests
Christian Kamm <kamm incasoftware de>
parents:
1489
diff
changeset
|
73 if(status++ != 6){ |
1025 | 74 assert(0); |
75 } | |
76 } | |
77 | |
1613
70a23cb6a616
Fix incorrect run.t.throw_07_A/B tests
Christian Kamm <kamm incasoftware de>
parents:
1489
diff
changeset
|
78 if(status != 7){ |
1025 | 79 assert(0); |
80 } | |
81 return 0; | |
82 } |