fix(swift3): lowercase enum value before checking reserved words (#4357)

Signed-off-by: Vincent Giersch <vincent@giersch.fr>
This commit is contained in:
Vincent Giersch
2016-12-20 02:35:03 -06:00
committed by wing328
parent 36b97c22af
commit 7f980cd9dd
5 changed files with 68 additions and 21 deletions

View File

@@ -13,14 +13,19 @@ public class Swift3CodegenTest {
Swift3Codegen swiftCodegen = new Swift3Codegen();
@Test
public void testCapitalizedReservedWord() throws Exception {
Assert.assertEquals(swiftCodegen.toEnumVarName("AS", null), "_as");
}
@Test
public void testReservedWord() throws Exception {
Assert.assertEquals(swiftCodegen.toEnumVarName("Public", null), "_public");
Assert.assertEquals(swiftCodegen.toEnumVarName("Public", null), "_public");
}
@Test
public void shouldNotBreakNonReservedWord() throws Exception {
Assert.assertEquals(swiftCodegen.toEnumVarName("Error", null), "error");
Assert.assertEquals(swiftCodegen.toEnumVarName("Error", null), "error");
}
@Test