-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
plugin/src/test/java/com/yelp/codegen/KotlinLangUtilsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.yelp.codegen | ||
|
||
import com.yelp.codegen.utils.sanitizeKotlinSpecificNames | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class KotlinLangUtilsTest { | ||
|
||
@Test | ||
fun sanitizeKotlinSpecificNames_withReplacementInMap() { | ||
assertEquals("valueSemicolon", "value;".sanitizeKotlinSpecificNames(mapOf(";" to "Semicolon"))) | ||
} | ||
|
||
@Test | ||
fun sanitizeKotlinSpecificNames_withDash() { | ||
assertEquals("value_", "value-".sanitizeKotlinSpecificNames(emptyMap())) | ||
} | ||
|
||
@Test | ||
fun sanitizeKotlinSpecificNames_withStartingNumber() { | ||
assertEquals("_42value", "42value".sanitizeKotlinSpecificNames(emptyMap())) | ||
} | ||
|
||
@Test | ||
fun sanitizeKotlinSpecificNames_withUnderscore() { | ||
assertEquals("Underscore", "_".sanitizeKotlinSpecificNames(emptyMap())) | ||
} | ||
|
||
@Test | ||
fun sanitizeKotlinSpecificNames_withMultipleUnderscores() { | ||
assertEquals("UnderscoreUnderscoreUnderscore", "___".sanitizeKotlinSpecificNames(emptyMap())) | ||
} | ||
} |