1025
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
|
5 // @author@ <mclysenk@mtu.edu>
|
|
6 // @date@ 2006-05-11
|
|
7 // @uri@ news:e3u2au$2l0c$1@digitaldaemon.com
|
|
8
|
|
9 module dstress.run.t.throw_07_C;
|
|
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{
|
|
65 if(status++ != 5){
|
|
66 assert(0);
|
|
67 }
|
|
68 t.test();
|
|
69 assert(0);
|
|
70 }catch(XException e){
|
|
71 if(status++ != 6){
|
|
72 assert(0);
|
|
73 }
|
|
74 }finally{
|
|
75 if(status++ != 7){
|
|
76 assert(0);
|
|
77 }
|
|
78 }
|
|
79
|
|
80 if(status != 8){
|
|
81 assert(0);
|
|
82 }
|
|
83 return 0;
|
|
84 }
|