Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/vararg/varargsAndFunctionLiterals.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

17 lines
387 B
Kotlin

fun foo(a: Int, vararg b: Int, f: (IntArray) -> String): String {
return "test" + a + " " + f(b)
}
fun box(): String {
val test1 = foo(1) {a -> "" + a.size}
if (test1 != "test1 0") return test1
val test2 = foo(2, 2) {a -> "" + a.size}
if (test2 != "test2 1") return test2
val test3 = foo(3, 2, 3) {a -> "" + a.size}
if (test3 != "test3 2") return test3
return "OK"
}