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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1025
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
1 // $HeadURL$
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
2 // $Date$
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
3 // $Author$
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
4
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
5 // @author@ <mclysenk@mtu.edu>
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
6 // @date@ 2006-05-11
1489
b8c0195059d9 changed nntp: URLs to http: URLs
thomask
parents: 1025
diff changeset
7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=7180
1025
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
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
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
10
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
11 int status;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
12
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
13 class XException : Exception{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
14 this(char[] msg){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
15 super(msg);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
16 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
17 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
18
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
19 class Tester{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
20 this(void delegate() dg_){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
21 if(status++ != 0){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
22 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
23 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
24 dg = dg_;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
25 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
26
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
27 void delegate() dg;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
28
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
29 void test() {
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
30 if(status++ != 1){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
31 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
32 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
33 dg();
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
34
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
35 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
36 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
37 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
38
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
39 int main(){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
40 void foo(){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
41 try{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
42 if(status++ != 2){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
43 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
44 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
45 throw new XException("test2");
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
46
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
47 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
48 }catch(XException e){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
49 if(status++ != 3){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
50 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
51 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
52 throw e;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
53 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
54 }finally{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
55 if(status++ != 4){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
56 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
57 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
58 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
59 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
60 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
61
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
62 Tester t = new Tester(&foo);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
63
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
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
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
66 t.test();
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
67 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
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
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
70 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
71 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
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
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
74 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
75 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
76 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
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
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
79 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
80 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
81 return 0;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
82 }