parseCommentedOutEnumWithoutExplicitValues

This commit is contained in:
rusefillc 2021-10-31 11:51:21 -04:00
parent 90aa913cfe
commit 408cf5309a
1 changed files with 30 additions and 0 deletions

View File

@ -227,4 +227,34 @@ public class EnumToStringTest {
"}\n", java);
}
}
@Test
public void parseCommentedOutEnumWithoutExplicitValues() throws IOException {
final StringReader reader = new StringReader(
"typedef enum {\n" +
"\t//GPIO_UNASSIGNED,\n" +
"\tGPIO_INVALID,\n" +
"\tGPIO_HEX,\n" +
"}brain_pin_e; // hello");
EnumsReader enumsReader = new EnumsReader().read(reader);
VariableRegistry registry = new VariableRegistry();
for (Map.Entry<String /*enum name*/, EnumsReader.EnumState> e : enumsReader.getEnums().entrySet()) {
String a = ToJavaEnum.generate(registry, e.getKey(), e.getValue());
assertEquals("package com.rusefi.enums;\n" +
"//auto-generated by ToJavaEnum.java\n" +
"\n" +
"\n" +
"\n" +
"public enum brain_pin_e {\n" +
"\tGPIO_INVALID,\n" +
"\tGPIO_HEX,\n" +
"}\n", a);
}
}
}