[IR][tests] Update tests to reflect changes in partial linkage error messages
This commit is contained in:
+14
-7
@@ -1,12 +1,19 @@
|
||||
fun box(): String {
|
||||
try {
|
||||
return bar()
|
||||
return try {
|
||||
bar()
|
||||
} catch(e: Throwable) {
|
||||
if (e.isLinkageError("/foo")) return "OK"
|
||||
e.checkLinkageError("function foo can not be called")
|
||||
}
|
||||
|
||||
return "FAIL2"
|
||||
}
|
||||
|
||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
||||
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||
|
||||
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||
val actualMessage = message.orEmpty()
|
||||
|
||||
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||
"OK"
|
||||
else
|
||||
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user