Mercurial > projects > dstress
comparison 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 |
comparison
equal
deleted
inserted
replaced
1614:709f6451b315 | 1615:8d5c55d163fd |
---|---|
1 // $HeadURL$ | |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 // @author@ Sean Kelly <sean@f4.ca> | |
6 // @date@ 2004-09-11 | |
7 | |
8 module dstress.run.scope_02; | |
9 | |
10 int status; | |
11 | |
12 scope class ScopeClass{ | |
13 void bad(){ | |
14 throw new Exception("error msg"); | |
15 } | |
16 | |
17 ~this(){ | |
18 if(status == 0){ | |
19 status--; | |
20 }else{ | |
21 status = -100; | |
22 } | |
23 } | |
24 } | |
25 | |
26 void test(){ | |
27 try{ | |
28 scope ScopeClass ac = new ScopeClass(); | |
29 ac.bad(); | |
30 }catch{ | |
31 if(status == -1){ | |
32 status = 20; | |
33 } | |
34 } | |
35 | |
36 if(status != 20){ | |
37 throw new Exception("dtor not called"); | |
38 } | |
39 } | |
40 | |
41 int main(){ | |
42 assert(status == 0); | |
43 | |
44 test(); | |
45 | |
46 if(status == 20){ | |
47 return 0; | |
48 } | |
49 } |