backend/tests: add runtime/memory/throw_cleanup.kt
This commit is contained in:
committed by
SvyatoslavScherbina
parent
4cfe569001
commit
5d8a28e5fc
@@ -797,6 +797,11 @@ task memory_var4(type: RunKonanTest) {
|
|||||||
source = "runtime/memory/var4.kt"
|
source = "runtime/memory/var4.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task memory_throw_cleanup(type: RunKonanTest) {
|
||||||
|
goldValue = "Ok\n"
|
||||||
|
source = "runtime/memory/throw_cleanup.kt"
|
||||||
|
}
|
||||||
|
|
||||||
task unit1(type: RunKonanTest) {
|
task unit1(type: RunKonanTest) {
|
||||||
goldValue = "First\nkotlin.Unit\n"
|
goldValue = "First\nkotlin.Unit\n"
|
||||||
source = "codegen/basics/unit1.kt"
|
source = "codegen/basics/unit1.kt"
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
foo(false)
|
||||||
|
try {
|
||||||
|
foo(true)
|
||||||
|
} catch (e: Error) {
|
||||||
|
println("Ok")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo(b: Boolean): Any {
|
||||||
|
var result = Any()
|
||||||
|
if (b) {
|
||||||
|
throw Error()
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user