[K/N] Make exception handling in initializers more consistent with jvm
^KT-57091
This commit is contained in:
committed by
Space Team
parent
0506d39d8a
commit
dc2e072af2
@@ -1557,34 +1557,6 @@ standaloneTest("initializers_workers2") {
|
||||
useGoldenData = true
|
||||
}
|
||||
|
||||
standaloneTest("initializers_failInInitializer1") {
|
||||
expectedFail = (project.testTarget == 'wasm32') // Uses exceptions.
|
||||
source = "codegen/initializers/failInInitializer1.kt"
|
||||
useGoldenData = true
|
||||
flags = ['-Xir-property-lazy-initialization=enable']
|
||||
}
|
||||
|
||||
standaloneTest("initializers_failInInitializer2") {
|
||||
expectedFail = (project.testTarget == 'wasm32') // Uses exceptions.
|
||||
source = "codegen/initializers/failInInitializer2.kt"
|
||||
useGoldenData = true
|
||||
flags = ['-Xir-property-lazy-initialization=enable']
|
||||
}
|
||||
|
||||
standaloneTest("initializers_failInInitializer3") {
|
||||
expectedFail = (project.testTarget == 'wasm32') // Uses exceptions.
|
||||
source = "codegen/initializers/failInInitializer3.kt"
|
||||
useGoldenData = true
|
||||
flags = ['-Xir-property-lazy-initialization=enable']
|
||||
}
|
||||
|
||||
standaloneTest("initializers_failInInitializer4") {
|
||||
expectedFail = (project.testTarget == 'wasm32') // Uses exceptions.
|
||||
source = "codegen/initializers/failInInitializer4.kt"
|
||||
useGoldenData = true
|
||||
flags = ['-Xir-property-lazy-initialization=enable']
|
||||
}
|
||||
|
||||
standaloneTest("initializers_when1") {
|
||||
source = "codegen/initializers/when1.kt"
|
||||
useGoldenData = true
|
||||
@@ -2839,7 +2811,7 @@ standaloneTest("exception_in_global_init") {
|
||||
enabled = (project.testTarget != 'wasm32') // Uses exceptions.
|
||||
source = "runtime/exceptions/exception_in_global_init.kt"
|
||||
expectedExitStatusChecker = { it != 0 }
|
||||
outputChecker = { s -> s.contains("Uncaught Kotlin exception:") && s.coinains("FAIL") && !s.contains("in kotlin main") }
|
||||
outputChecker = { s -> s.contains("Uncaught Kotlin exception:") && s.contains("FAIL") && !s.contains("in kotlin main") }
|
||||
}
|
||||
|
||||
task rethrow_exception(type: KonanLocalTest) {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// FILE: lib.kt
|
||||
val x: String = computeX()
|
||||
|
||||
fun computeX(): String = error("zzz")
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
try {
|
||||
println(x)
|
||||
} catch(t: IllegalStateException) {
|
||||
println("caught")
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
caught
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// FILE: lib.kt
|
||||
val x: String = computeX()
|
||||
|
||||
fun computeX(): String = error("zzz")
|
||||
|
||||
val y: String = computeY()
|
||||
|
||||
fun computeY(): String = "qzz"
|
||||
|
||||
// FILE: main.kt
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun main() {
|
||||
try {
|
||||
println(x)
|
||||
} catch(t: IllegalStateException) {
|
||||
println("caught")
|
||||
}
|
||||
try {
|
||||
println(y)
|
||||
} catch(t: kotlin.native.FileFailedToInitializeException) {
|
||||
println("caught2")
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
caught
|
||||
caught2
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// FILE: lib.kt
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@ThreadLocal
|
||||
val x: String = computeX()
|
||||
|
||||
fun computeX(): String = error("zzz")
|
||||
|
||||
val y: String = computeY()
|
||||
|
||||
fun computeY(): String = "qzz"
|
||||
|
||||
// FILE: main.kt
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun main() {
|
||||
try {
|
||||
println(x)
|
||||
} catch(t: IllegalStateException) {
|
||||
println("caught")
|
||||
}
|
||||
try {
|
||||
println(y)
|
||||
} catch(t: kotlin.native.FileFailedToInitializeException) {
|
||||
println("caught2")
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
caught
|
||||
caught2
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// FILE: lib.kt
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@ThreadLocal
|
||||
val x: String = computeX()
|
||||
|
||||
fun computeX(): String = error("zzz")
|
||||
|
||||
@ThreadLocal
|
||||
val y: String = computeY()
|
||||
|
||||
fun computeY(): String = "qzz"
|
||||
|
||||
// FILE: main.kt
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun main() {
|
||||
try {
|
||||
println(x)
|
||||
} catch(t: IllegalStateException) {
|
||||
println("caught")
|
||||
}
|
||||
try {
|
||||
println(y)
|
||||
} catch(t: kotlin.native.FileFailedToInitializeException) {
|
||||
println("caught2")
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
caught
|
||||
caught2
|
||||
Reference in New Issue
Block a user