Print generated bytecode on AbstractCheckLocalVariablesTableTest fail
This commit is contained in:
+6
@@ -22,6 +22,7 @@ import com.intellij.util.containers.ContainerUtil
|
|||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
|
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
|
import org.jetbrains.kotlin.utils.rethrow
|
||||||
import org.jetbrains.org.objectweb.asm.*
|
import org.jetbrains.org.objectweb.asm.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@@ -39,6 +40,7 @@ abstract class AbstractCheckLocalVariablesTableTest : CodegenTestCase() {
|
|||||||
override fun doMultiFileTest(wholeFile: File, files: List<CodegenTestCase.TestFile>, javaFilesDir: File?) {
|
override fun doMultiFileTest(wholeFile: File, files: List<CodegenTestCase.TestFile>, javaFilesDir: File?) {
|
||||||
compile(files, javaFilesDir)
|
compile(files, javaFilesDir)
|
||||||
|
|
||||||
|
try {
|
||||||
val classAndMethod = parseClassAndMethodSignature(wholeFile)
|
val classAndMethod = parseClassAndMethodSignature(wholeFile)
|
||||||
val split = classAndMethod.split("\\.".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
val split = classAndMethod.split("\\.".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||||
assert(split.size == 2) { "Exactly one dot is expected: $classAndMethod" }
|
assert(split.size == 2) { "Exactly one dot is expected: $classAndMethod" }
|
||||||
@@ -54,6 +56,10 @@ abstract class AbstractCheckLocalVariablesTableTest : CodegenTestCase() {
|
|||||||
val actualLocalVariables = readLocalVariable(ClassReader(outputFile!!.asByteArray()), methodName)
|
val actualLocalVariables = readLocalVariable(ClassReader(outputFile!!.asByteArray()), methodName)
|
||||||
|
|
||||||
doCompare(wholeFile, files.single().content, actualLocalVariables)
|
doCompare(wholeFile, files.single().content, actualLocalVariables)
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
println(classFileFactory.createText())
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun doCompare(
|
protected open fun doCompare(
|
||||||
|
|||||||
Reference in New Issue
Block a user