Mercurial > projects > ldc
changeset 832:0cc0c6b53372
Add testcase for with(symbol) fix.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 07 Dec 2008 16:06:10 +0100 |
parents | 7e59caf41433 |
children | 482cd74d1c71 |
files | tests/mini/with3.d |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/mini/with3.d Sun Dec 07 16:06:10 2008 +0100 @@ -0,0 +1,21 @@ +enum fields +{ + FIELD1, + FIELD2 +} + +fields find_field(fields f) { + with(fields) { + switch(f) { + case FIELD1: + return FIELD1; + default: + return FIELD2; + } + } +} + +void main() { + assert(find_field(fields.FIELD1) == fields.FIELD1); + assert(find_field(fields.FIELD2) == fields.FIELD2); +}