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_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 if(status++ != 5){
|
|
67 assert(0);
|
|
68 }
|
|
69 t.test();
|
|
70 assert(0);
|
|
71 }catch(XException e){
|
|
72 if(status++ != 6){
|
|
73 assert(0);
|
|
74 }
|
|
75 }finally{
|
|
76 if(status++ != 7){
|
|
77 assert(0);
|
|
78 }
|
|
79 }
|
|
80
|
|
81 if(status != 8){
|
|
82 assert(0);
|
|
83 }
|
|
84 return 0;
|
|
85 }
|