Fix codegen & bytecode tests after unifying exceptions in JVM backend

See KT-22275 for details
This commit is contained in:
Mikhail Zarechenskiy
2020-01-20 13:51:11 +03:00
parent 1ed7e33f42
commit 5c5635ce20
34 changed files with 55 additions and 55 deletions
@@ -1,15 +1,15 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS
// FILE: callAssertions.kt
class AssertionChecker(val illegalStateExpected: Boolean) {
class AssertionChecker(val nullPointerExceptionExpected: Boolean) {
operator fun invoke(name: String, f: () -> Any) {
try {
f()
} catch (e: IllegalStateException) {
if (!illegalStateExpected) throw AssertionError("Unexpected IllegalStateException on calling $name")
} catch (e: NullPointerException) {
if (!nullPointerExceptionExpected) throw AssertionError("Unexpected NullPointerException on calling $name")
return
}
if (illegalStateExpected) throw AssertionError("IllegalStateException expected on calling $name")
if (nullPointerExceptionExpected) throw AssertionError("NullPointerException expected on calling $name")
}
}