backend: add two more tests for finally

This commit is contained in:
Svyatoslav Scherbina
2016-12-05 13:34:10 +07:00
committed by SvyatoslavScherbina
parent 4a1b3f2824
commit 2531c34b64
3 changed files with 38 additions and 0 deletions
+10
View File
@@ -579,6 +579,16 @@ task finally9(type: RunKonanTest) {
source = "codegen/try/finally9.kt"
}
task finally10(type: RunKonanTest) {
goldValue = "Finally\nAfter\n"
source = "codegen/try/finally10.kt"
}
task finally11(type: RunKonanTest) {
goldValue = "Finally\nCatch 2\nDone\n"
source = "codegen/try/finally11.kt"
}
task scope1(type: RunKonanTest) {
goldValue = "1\n"
source = "codegen/dataflow/scope1.kt"
@@ -0,0 +1,12 @@
fun main(args : Array<String>) {
while (true) {
try {
continue
} finally {
println("Finally")
break
}
}
println("After")
}
@@ -0,0 +1,16 @@
fun main(args : Array<String>) {
try {
try {
return
} catch (e: Error) {
println("Catch 1")
} finally {
println("Finally")
throw Error()
}
} catch (e: Error) {
println("Catch 2")
}
println("Done")
}