Mercurial > projects > ldc
diff 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 |
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); +}