From 7540f4f6ccbcc78578dc1d489ee6e85e3a3ac5ad Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 31 Oct 2021 11:51:21 -0400 Subject: [PATCH] parseCommentedOutEnumWithoutExplicitValues --- .../java/com/rusefi/EnumToStringTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/java_tools/enum_to_string/src/test/java/com/rusefi/EnumToStringTest.java b/java_tools/enum_to_string/src/test/java/com/rusefi/EnumToStringTest.java index b54fe4dbc8..86d1211f35 100644 --- a/java_tools/enum_to_string/src/test/java/com/rusefi/EnumToStringTest.java +++ b/java_tools/enum_to_string/src/test/java/com/rusefi/EnumToStringTest.java @@ -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 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); + } + } + }