backend: add tests for try-catch-finally and throwing exceptions

also add some tests for bugs with unreachable code handling and variables
This commit is contained in:
Svyatoslav Scherbina
2016-11-28 18:19:06 +07:00
parent 70fa3ba56a
commit e2dbeae85e
24 changed files with 462 additions and 0 deletions
@@ -0,0 +1,25 @@
fun main(args : Array<String>) {
try {
try {
println("Try")
throw Error("Error happens")
println("After throw")
} catch (e: Error) {
println("Catch")
throw Exception()
println("After throw")
} finally {
println("Finally")
}
println("After nested try")
} catch (e: Error) {
println("Caught Error")
} catch (e: Exception) {
println("Caught Exception")
}
println("Done")
}