Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

24 lines
547 B
Kotlin

// WITH_RUNTIME
operator fun Int.component1(): String {
return arrayListOf("zero", "one", "two", "three")[this]
}
operator fun Int.component2(): Int {
return arrayListOf(0, 1, 4, 9)[this]
}
fun box(): String {
val strings = arrayListOf<String>()
val squares = arrayListOf<Int>()
for ((str, sq) in 1..3) {
strings.add(str)
squares.add(sq)
}
if (strings != arrayListOf("one", "two", "three")) return "FAIL: $strings"
if (squares != arrayListOf(1, 4, 9)) return "FAIL: $squares"
return "OK"
}