Mercurial > projects > dstress
annotate run/scope_02.d @ 1615:8d5c55d163fd
Fix some outdated tests that used auto to mean scope.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 12 Jul 2009 16:44:52 +0200 |
parents | run/auto_02.d@ec5e144583ea |
children |
rev | line source |
---|---|
374 | 1 // $HeadURL$ |
2 // $Date$ | |
3 // $Author$ | |
0 | 4 |
5 // @author@ Sean Kelly <sean@f4.ca> | |
6 // @date@ 2004-09-11 | |
7 | |
1615
8d5c55d163fd
Fix some outdated tests that used auto to mean scope.
Christian Kamm <kamm incasoftware de>
parents:
1559
diff
changeset
|
8 module dstress.run.scope_02; |
374 | 9 |
0 | 10 int status; |
11 | |
1615
8d5c55d163fd
Fix some outdated tests that used auto to mean scope.
Christian Kamm <kamm incasoftware de>
parents:
1559
diff
changeset
|
12 scope class ScopeClass{ |
0 | 13 void bad(){ |
14 throw new Exception("error msg"); | |
15 } | |
1559 | 16 |
0 | 17 ~this(){ |
799 | 18 if(status == 0){ |
19 status--; | |
20 }else{ | |
21 status = -100; | |
22 } | |
0 | 23 } |
24 } | |
25 | |
26 void test(){ | |
27 try{ | |
1615
8d5c55d163fd
Fix some outdated tests that used auto to mean scope.
Christian Kamm <kamm incasoftware de>
parents:
1559
diff
changeset
|
28 scope ScopeClass ac = new ScopeClass(); |
0 | 29 ac.bad(); |
30 }catch{ | |
799 | 31 if(status == -1){ |
32 status = 20; | |
33 } | |
34 } | |
35 | |
36 if(status != 20){ | |
37 throw new Exception("dtor not called"); | |
0 | 38 } |
39 } | |
40 | |
41 int main(){ | |
799 | 42 assert(status == 0); |
43 | |
0 | 44 test(); |
799 | 45 |
46 if(status == 20){ | |
47 return 0; | |
48 } | |
0 | 49 } |