[IR][tests] Make ABI compatibility tests less verbose, part 2

This commit is contained in:
Dmitriy Dolovov
2022-08-23 15:00:26 +02:00
parent db1c8cc7a7
commit 24d8ac97cd
24 changed files with 173 additions and 1242 deletions
+4 -18
View File
@@ -1,19 +1,5 @@
fun box(): String {
return try {
bar()
} catch(e: Throwable) {
e.checkLinkageError("function foo can not be called")
}
}
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"
import abitestutils.abiTest
fun box() = abiTest {
expectFailure(prefixed("function foo can not be called")) { bar() }
}