backend/tests: add runtime/memory/throw_cleanup.kt

This commit is contained in:
Svyatoslav Scherbina
2016-12-29 12:54:56 +07:00
committed by SvyatoslavScherbina
parent 4cfe569001
commit 5d8a28e5fc
2 changed files with 21 additions and 0 deletions
+5
View File
@@ -797,6 +797,11 @@ task memory_var4(type: RunKonanTest) {
source = "runtime/memory/var4.kt"
}
task memory_throw_cleanup(type: RunKonanTest) {
goldValue = "Ok\n"
source = "runtime/memory/throw_cleanup.kt"
}
task unit1(type: RunKonanTest) {
goldValue = "First\nkotlin.Unit\n"
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
}