Mercurial > projects > dstress
annotate run/t/throw_07_B.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 |
9 module dstress.run.t.throw_07_B; | |
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 function() dg_){ | |
21 if(status++ != 0){ | |
22 assert(0); | |
23 } | |
24 dg = dg_; | |
25 } | |
26 | |
27 void function() dg; | |
28 | |
29 void test() { | |
30 if(status++ != 1){ | |
31 assert(0); | |
32 } | |
33 dg(); | |
34 | |
35 assert(0); | |
36 } | |
37 } | |
38 | |
39 void foo(){ | |
40 try{ | |
41 if(status++ != 2){ | |
42 assert(0); | |
43 } | |
44 throw new XException("test2"); | |
45 | |
46 assert(0); | |
47 }catch(XException e){ | |
48 if(status++ != 3){ | |
49 assert(0); | |
50 } | |
51 throw e; | |
52 assert(0); | |
53 }finally{ | |
54 if(status++ != 4){ | |
55 assert(0); | |
56 } | |
57 } | |
58 assert(0); | |
59 } | |
60 | |
61 int main(){ | |
62 | |
63 Tester t = new Tester(&foo); | |
64 | |
65 try{ | |
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 } |