[IR][tests] Make ABI compatibility tests less verbose, part 2
This commit is contained in:
+3
-21
@@ -1,26 +1,8 @@
|
||||
import abitestutils.abiTest
|
||||
import lib1.A
|
||||
import lib2.B
|
||||
|
||||
fun box(): String {
|
||||
fun box() = abiTest {
|
||||
val a: A = B()
|
||||
|
||||
return try {
|
||||
val answer: Int = a.foo() // <-- should throw linkage error here
|
||||
println(answer)
|
||||
"FAIL"
|
||||
} catch (e: Throwable) {
|
||||
e.checkLinkageError("foo", "B")
|
||||
}
|
||||
}
|
||||
|
||||
private fun Throwable.checkLinkageError(symbolName: String, className: String): String {
|
||||
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||
|
||||
val expectedMessage = "Abstract function $symbolName is not implemented in non-abstract class $className"
|
||||
val actualMessage = message.orEmpty()
|
||||
|
||||
return if (expectedMessage == actualMessage)
|
||||
"OK"
|
||||
else
|
||||
"EXPECTED: $expectedMessage, ACTUAL: $actualMessage"
|
||||
expectFailure(nonImplementedCallable("function foo", "class B")) { a.foo() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user