[Spec tests] Unify platform dependent part of fixed exception
This commit is contained in:
@@ -63,14 +63,22 @@ class TestExceptionsComparator(wholeFile: File) {
|
||||
Pattern.compile("""Exception while analyzing expression at \((?<lineNumber>\d+),(?<symbolNumber>\d+)\) in /(?<filename>.*?)$""")
|
||||
)
|
||||
private val ls = System.lineSeparator()
|
||||
|
||||
private const val BYTECODE_ADDRESS = """\d{7}"""
|
||||
private val bytecodeAddressRegex = Regex(BYTECODE_ADDRESS)
|
||||
private val bytecodeAddressListRegex = Regex("""Bytecode:\s+($BYTECODE_ADDRESS:\s*([0-9a-f]{4}\s+)+\s+)+""")
|
||||
|
||||
private fun unifyPlatformDependentOfException(exceptionText: String) =
|
||||
exceptionText.replace(bytecodeAddressListRegex) { bytecodeAddresses ->
|
||||
bytecodeAddresses.value.replace(bytecodeAddressRegex) { "0x${it.value}" }
|
||||
}
|
||||
}
|
||||
|
||||
private val filePathPrefix = "${wholeFile.parent}/${wholeFile.nameWithoutExtension}.$EXCEPTIONS_FILE_PREFIX"
|
||||
|
||||
private fun analyze(e: Throwable): Matcher? {
|
||||
for ((_, pattern) in exceptionMessagePatterns) {
|
||||
if (e.message == null) continue
|
||||
val matches = pattern.matcher(e.message)
|
||||
val matches = pattern.matcher(e.message ?: continue)
|
||||
if (matches.find()) return matches
|
||||
}
|
||||
|
||||
@@ -83,7 +91,8 @@ class TestExceptionsComparator(wholeFile: File) {
|
||||
return when (e) {
|
||||
is TestsRuntimeError ->
|
||||
(e.original.cause ?: e.original).run {
|
||||
casesAsString + toString() + stackTrace[0]?.let { ls + it }
|
||||
val exceptionText = casesAsString + toString() + stackTrace[0]?.let { ls + it }
|
||||
unifyPlatformDependentOfException(exceptionText)
|
||||
}
|
||||
is TestsCompilerError, is TestsCompiletimeError, is TestsInfrastructureError -> casesAsString + (e.original.cause ?: e.original).toString()
|
||||
}
|
||||
|
||||
compiler/tests-spec/testData/codegen/box/notLinked/objects/inheritance/neg/13.exceptions.runtime.txt
Vendored
+1
-1
@@ -10,6 +10,6 @@ Exception Details:
|
||||
locals: { uninitializedThis }
|
||||
stack: { uninitializedThis, uninitializedThis }
|
||||
Bytecode:
|
||||
0000000: 2a2a c000 02b6 000a b700 0db1
|
||||
0x0000000: 2a2a c000 02b6 000a b700 0db1
|
||||
|
||||
Foo.<clinit>(13.kt)
|
||||
compiler/tests-spec/testData/codegen/box/notLinked/objects/inheritance/neg/16.exceptions.runtime.txt
Vendored
+1
-1
@@ -10,6 +10,6 @@ Exception Details:
|
||||
locals: { uninitializedThis }
|
||||
stack: { uninitializedThis, uninitializedThis }
|
||||
Bytecode:
|
||||
0000000: 2a2a c000 02b6 000a b700 0db1
|
||||
0x0000000: 2a2a c000 02b6 000a b700 0db1
|
||||
|
||||
Foo.<clinit>(16.kt)
|
||||
compiler/tests-spec/testData/codegen/box/notLinked/objects/inheritance/neg/17.exceptions.runtime.txt
Vendored
+1
-1
@@ -10,6 +10,6 @@ Exception Details:
|
||||
locals: { uninitializedThis }
|
||||
stack: { uninitializedThis, uninitializedThis }
|
||||
Bytecode:
|
||||
0000000: 2a2a c000 02b6 000a b700 0db1
|
||||
0x0000000: 2a2a c000 02b6 000a b700 0db1
|
||||
|
||||
Foo.<clinit>(17.kt)
|
||||
Vendored
+1
-1
@@ -10,6 +10,6 @@ Exception Details:
|
||||
locals: { uninitializedThis }
|
||||
stack: { uninitializedThis, uninitializedThis }
|
||||
Bytecode:
|
||||
0000000: 2a2a b700 09b1
|
||||
0x0000000: 2a2a b700 09b1
|
||||
|
||||
Foo.<clinit>(9.kt)
|
||||
Reference in New Issue
Block a user