JS backend: added tests for labels
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
package foo
|
||||
|
||||
inline fun testLabelInline(): Int {
|
||||
var a = 0
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
if (i == 1) continue@loop
|
||||
|
||||
a += i
|
||||
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
if (i == 1) continue@loop
|
||||
|
||||
a += i
|
||||
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
fun testLabel(): String {
|
||||
var a = 0
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
if (i == 1) continue@loop
|
||||
|
||||
a += testLabelInline()
|
||||
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
|
||||
if (a != 4) return a.toString()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("OK", testLabel())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user