Reformat and cleanup most JVM codegen test classes
This commit is contained in:
@@ -22,29 +22,35 @@ import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
class CustomBytecodeTextTest : AbstractBytecodeTextTest() {
|
||||
fun testEnumMapping() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL)
|
||||
myFiles = CodegenTestFiles.create("whenMappingOrder.kt", """
|
||||
enum class MyEnum {
|
||||
ENTRY1, ENTRY2, ENTRY3, ENTRY4
|
||||
}
|
||||
|
||||
fun f(e: MyEnum) {
|
||||
when (e) {
|
||||
MyEnum.ENTRY4 -> {}
|
||||
MyEnum.ENTRY3 -> {}
|
||||
MyEnum.ENTRY2 -> {}
|
||||
MyEnum.ENTRY1 -> {}
|
||||
myFiles = CodegenTestFiles.create(
|
||||
"whenMappingOrder.kt",
|
||||
"""
|
||||
enum class MyEnum {
|
||||
ENTRY1, ENTRY2, ENTRY3, ENTRY4
|
||||
}
|
||||
}
|
||||
""", myEnvironment.project)
|
||||
|
||||
fun f(e: MyEnum) {
|
||||
when (e) {
|
||||
MyEnum.ENTRY4 -> {}
|
||||
MyEnum.ENTRY3 -> {}
|
||||
MyEnum.ENTRY2 -> {}
|
||||
MyEnum.ENTRY1 -> {}
|
||||
}
|
||||
}
|
||||
""",
|
||||
myEnvironment.project
|
||||
)
|
||||
|
||||
val text = generateToText()
|
||||
val getstatics = text.lines().filter { it.contains("GETSTATIC MyEnum.") }.map { it.trim() }
|
||||
KtUsefulTestCase.assertOrderedEquals("actual bytecode:\n" + text, listOf(
|
||||
KtUsefulTestCase.assertOrderedEquals(
|
||||
"actual bytecode:\n$text", listOf(
|
||||
"GETSTATIC MyEnum.${'$'}VALUES : [LMyEnum;",
|
||||
"GETSTATIC MyEnum.ENTRY4 : LMyEnum;",
|
||||
"GETSTATIC MyEnum.ENTRY3 : LMyEnum;",
|
||||
"GETSTATIC MyEnum.ENTRY2 : LMyEnum;",
|
||||
"GETSTATIC MyEnum.ENTRY1 : LMyEnum;"
|
||||
), getstatics)
|
||||
), getstatics
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user