TEST: throw keyword support.
This commit is contained in:
committed by
KonstantinAnisimov
parent
0cd4512dd5
commit
81811e8c3a
@@ -380,9 +380,14 @@ task intrinsic(type: UnitKonanTest) {
|
||||
task link(type: LinkKonanTest) {
|
||||
source = "link/src/bar.kt"
|
||||
lib = "link/lib"
|
||||
}
|
||||
}
|
||||
|
||||
task for0(type: RunKonanTest) {
|
||||
goldValue = "2\n3\n4\n"
|
||||
source = "runtime/basic/for0.kt"
|
||||
}
|
||||
}
|
||||
|
||||
task throw0(type: RunKonanTest) {
|
||||
goldValue = "Done\n"
|
||||
source = "runtime/basic/throw0.kt"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fun main(args : Array<String>) {
|
||||
val cond = 1
|
||||
if (cond == 2) throw RuntimeException()
|
||||
if (cond == 3) throw NoSuchElementException("no such element")
|
||||
if (cond == 4) throw Error("error happens")
|
||||
|
||||
println("Done")
|
||||
}
|
||||
Reference in New Issue
Block a user