JVM IR: minor, mute and adapt noCallAssertions.kt to 1.4
This commit is contained in:
+7
-6
@@ -1,15 +1,16 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS, +JVM.DISABLE_CALL_ASSERTIONS
|
// KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS, +JVM.DISABLE_CALL_ASSERTIONS
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
// FILE: noCallAssertions.kt
|
// FILE: noCallAssertions.kt
|
||||||
|
|
||||||
class AssertionChecker(val illegalStateExpected: Boolean) {
|
class AssertionChecker(val nullPointerExceptionExpected: Boolean) {
|
||||||
operator fun invoke(name: String, f: () -> Any) {
|
operator fun invoke(name: String, f: () -> Any) {
|
||||||
try {
|
try {
|
||||||
f()
|
f()
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: NullPointerException) {
|
||||||
if (!illegalStateExpected) throw AssertionError("Unexpected IllegalStateException on calling $name")
|
if (!nullPointerExceptionExpected) throw AssertionError("Unexpected NullPointerException on calling $name")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (illegalStateExpected) throw AssertionError("IllegalStateException expected on calling $name")
|
if (nullPointerExceptionExpected) throw AssertionError("NullPointerException expected on calling $name")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,8 +26,8 @@ class Derived : A(), Tr {
|
|||||||
class Delegated : Tr by Derived() {
|
class Delegated : Tr by Derived() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkAssertions(illegalStateExpected: Boolean) {
|
fun checkAssertions(nullPointerExceptionExpected: Boolean) {
|
||||||
val check = AssertionChecker(illegalStateExpected)
|
val check = AssertionChecker(nullPointerExceptionExpected)
|
||||||
|
|
||||||
// simple call
|
// simple call
|
||||||
check("foo") { A().foo() }
|
check("foo") { A().foo() }
|
||||||
|
|||||||
Reference in New Issue
Block a user