Swift enum names capitalization follows Swift convention.

This commit is contained in:
Tomek Cejner
2015-10-25 00:04:25 +02:00
parent ea7ef990b9
commit 6247dd0cde
2 changed files with 57 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
package io.swagger.codegen.languages;
import org.testng.Assert;
import org.testng.annotations.Test;
public class SwiftCodegenTest {
SwiftCodegen swiftCodegen = new SwiftCodegen();
@Test
public void shouldNotBreakCorrectName() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("EntryName"), "EntryName");
}
@Test
public void testSingleWordAllCaps() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("VALUE"), "Value");
}
@Test
public void testSingleWordLowercase() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("value"), "Value");
}
@Test
public void testCapitalsWithUnderscore() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("ENTRY_NAME"), "EntryName");
}
@Test
public void testCapitalsWithDash() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("ENTRY-NAME"), "EntryName");
}
@Test
public void testCapitalsWithSpace() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("ENTRY NAME"), "EntryName");
}
@Test
public void testLowercaseWithUnderscore() throws Exception {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("entry_name"), "EntryName");
}
}