annotate run/s/switch_22_C.d @ 1604:cc724d521a34

Add note about possible issues with test case depending on switch scopes.
author Christian Kamm <kamm incasoftware de>
date Sat, 28 Mar 2009 19:17:58 +0100
parents 986983b8cf7a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1060
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
1 // $HeadURL$
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
2 // $Date$
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
3 // $Author$
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
4
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
5 // @author@ <BCS@pathlink.com>
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
6 // @date@ 2006-06-16
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
7 // @uri@ news:e6umde$2ok0$2@digitaldaemon.com
1336
986983b8cf7a adde bugilla URL
thomask
parents: 1061
diff changeset
8 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=729
1060
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
9
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
10 module dstress.run.s.switch_22_C;
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
11
1604
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
12 /+
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
13 The validity of this test case is dubious:
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
14 the spec is not explicit about scopes in a switch statement
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
15 and DMD transforms the scope(success) into:
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
16
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
17 switch(3){
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
18 bool success = true;
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
19 try { default: }
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
20 catch(Object e) { success = false; throw e; }
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
21 finally { if(success) i--; }
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
22 }
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
23 +/
cc724d521a34 Add note about possible issues with test case depending on switch scopes.
Christian Kamm <kamm incasoftware de>
parents: 1336
diff changeset
24
1060
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
25 int main(){
1061
5bbc978e55a0 fixed switch_22 thx to BCS
thomask
parents: 1060
diff changeset
26 int i = 2;
1060
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
27
1061
5bbc978e55a0 fixed switch_22 thx to BCS
thomask
parents: 1060
diff changeset
28 switch(3){
1060
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
29 scope(success) i--;
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
30
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
31 default:
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
32 }
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
33
1061
5bbc978e55a0 fixed switch_22 thx to BCS
thomask
parents: 1060
diff changeset
34 if(i != 2){
1060
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
35 assert(0);
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
36 }
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
37
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
38 return 0;
039ab9232f59 <BCS@pathlink.com>
thomask
parents:
diff changeset
39 }