forked from loafle/openapi-generator-original
Swift enum names capitalization follows Swift convention.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user