Merge boxWithStdlib testData into box, delete BoxWithStdlib test
This commit is contained in:
committed by
Alexander Udalov
parent
22bfc9786a
commit
06a67e6602
+33
@@ -0,0 +1,33 @@
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun foo(bar: String): Int = bar.length
|
||||
|
||||
class A(val c: String) {
|
||||
fun foz(baz: Int) {}
|
||||
|
||||
fun Double.mext(mez: Long) {}
|
||||
}
|
||||
|
||||
fun Int.qux(zux: String) {}
|
||||
|
||||
fun checkParameters(f: KFunction<*>, names: List<String?>) {
|
||||
val params = f.parameters
|
||||
assertEquals(names, params.map { it.name })
|
||||
assertEquals(params.indices.toList(), params.map { it.index })
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
checkParameters(::box, listOf())
|
||||
checkParameters(::foo, listOf("bar"))
|
||||
checkParameters(A::foz, listOf(null, "baz"))
|
||||
checkParameters(Int::qux, listOf(null, "zux"))
|
||||
|
||||
checkParameters(A::class.functions.single { it.name == "mext" }, listOf(null, null, "mez"))
|
||||
|
||||
checkParameters(::A, listOf("c"))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user