Mercurial > projects > ldc
comparison tests/mini/with3.d @ 832:0cc0c6b53372
Add testcase for with(symbol) fix.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 07 Dec 2008 16:06:10 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
831:7e59caf41433 | 832:0cc0c6b53372 |
---|---|
1 enum fields | |
2 { | |
3 FIELD1, | |
4 FIELD2 | |
5 } | |
6 | |
7 fields find_field(fields f) { | |
8 with(fields) { | |
9 switch(f) { | |
10 case FIELD1: | |
11 return FIELD1; | |
12 default: | |
13 return FIELD2; | |
14 } | |
15 } | |
16 } | |
17 | |
18 void main() { | |
19 assert(find_field(fields.FIELD1) == fields.FIELD1); | |
20 assert(find_field(fields.FIELD2) == fields.FIELD2); | |
21 } |