Sanitize names for script class files

Use the same process that is done for package parts in the JVM back-end, except
adding the "Kt" suffix

 #KT-15225 Fixed
This commit is contained in:
Alexander Udalov
2017-01-11 14:31:22 +03:00
parent 6ffa56b640
commit abe2ad155c
7 changed files with 17 additions and 38 deletions
@@ -90,6 +90,13 @@ class ScriptGenTest : CodegenTestCase() {
assertEquals(239, invoke as Int / 2)
}
fun testNameSanitation() {
setUpEnvironment("scriptCustom/1#@2.kts")
val aClass = generateClass("_1__2")
assertEquals("OK", aClass.getDeclaredMethod("getResult")(aClass.newInstance()))
}
private fun setUpEnvironment(sourcePath: String) {
setUpEnvironment(listOf(sourcePath))
}