blob: c35b7238d14faa9f44477fed3e0e66b2c03df573 [file]
// WITH_STDLIB
// TARGET_BACKEND: WASM
// USE_OLD_EXCEPTION_HANDLING_PROPOSAL
// WASM_FAILS_IN: Wasmtime, WasmEdge
import kotlin.test.*
val sb = StringBuilder()
fun box(): String {
try {
sb.appendLine("Before")
foo()
sb.appendLine("After")
} catch (e: Throwable) {
sb.appendLine("Caught Throwable")
}
sb.appendLine("Done")
assertEquals("""
Before
Caught Throwable
Done
""".trimIndent(), sb.toString())
return "OK"
}
fun foo() {
throw Error("Error happens")
sb.appendLine("After in foo()")
}