mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-07-29 10:30:04 +02:00
Add testcase for with(symbol) fix.
This commit is contained in:
21
tests/mini/with3.d
Normal file
21
tests/mini/with3.d
Normal file
@@ -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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user