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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
374
f87ba6507260 added missing meta-data
thomask
parents: 1
diff changeset
1 // $HeadURL$
f87ba6507260 added missing meta-data
thomask
parents: 1
diff changeset
2 // $Date$
f87ba6507260 added missing meta-data
thomask
parents: 1
diff changeset
3 // $Author$
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
4
3269e4627918 init dstress
svnowner
parents:
diff changeset
5 // @author@ Sean Kelly <sean@f4.ca>
3269e4627918 init dstress
svnowner
parents:
diff changeset
6 // @date@ 2004-09-11
3269e4627918 init dstress
svnowner
parents:
diff changeset
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
f87ba6507260 added missing meta-data
thomask
parents: 1
diff changeset
9
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
10 int status;
3269e4627918 init dstress
svnowner
parents:
diff changeset
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
3269e4627918 init dstress
svnowner
parents:
diff changeset
13 void bad(){
3269e4627918 init dstress
svnowner
parents:
diff changeset
14 throw new Exception("error msg");
3269e4627918 init dstress
svnowner
parents:
diff changeset
15 }
1559
ec5e144583ea D1 -> D2 : 1/N
thomask
parents: 799
diff changeset
16
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
17 ~this(){
799
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
18 if(status == 0){
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
19 status--;
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
20 }else{
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
21 status = -100;
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
22 }
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
23 }
3269e4627918 init dstress
svnowner
parents:
diff changeset
24 }
3269e4627918 init dstress
svnowner
parents:
diff changeset
25
3269e4627918 init dstress
svnowner
parents:
diff changeset
26 void test(){
3269e4627918 init dstress
svnowner
parents:
diff changeset
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
3269e4627918 init dstress
svnowner
parents:
diff changeset
29 ac.bad();
3269e4627918 init dstress
svnowner
parents:
diff changeset
30 }catch{
799
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
31 if(status == -1){
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
32 status = 20;
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
33 }
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
34 }
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
35
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
36 if(status != 20){
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
37 throw new Exception("dtor not called");
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
38 }
3269e4627918 init dstress
svnowner
parents:
diff changeset
39 }
3269e4627918 init dstress
svnowner
parents:
diff changeset
40
3269e4627918 init dstress
svnowner
parents:
diff changeset
41 int main(){
799
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
42 assert(status == 0);
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
43
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
44 test();
799
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
45
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
46 if(status == 20){
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
47 return 0;
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 374
diff changeset
48 }
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
49 }