Merge boxWithStdlib testData into box, delete BoxWithStdlib test

This commit is contained in:
Alexander Udalov
2016-03-07 13:36:14 +03:00
committed by Alexander Udalov
parent 22bfc9786a
commit 06a67e6602
535 changed files with 3520 additions and 3871 deletions
@@ -0,0 +1,7 @@
// WITH_REFLECT
fun doStuff(fn: String.() -> String) = "ok".fn()
fun box(): String {
return doStuff(String::toUpperCase)
}
@@ -0,0 +1,6 @@
// WITH_REFLECT
@JvmName("Fail")
fun OK() {}
fun box() = ::OK.name
@@ -0,0 +1,24 @@
// WITH_REFLECT
import kotlin.reflect.*
import kotlin.reflect.jvm.*
import kotlin.test.assertEquals
class A {
private fun foo() = "A"
}
fun box(): String {
val f = A::class.declaredFunctions.single() as KFunction<String>
try {
f.call(A())
return "Fail: no exception was thrown"
} catch (e: IllegalCallableAccessException) {}
f.isAccessible = true
assertEquals("A", f.call(A()))
return "OK"
}
@@ -0,0 +1,23 @@
// WITH_REFLECT
import kotlin.reflect.*
open class A {
fun mem() {}
fun Int.memExt() {}
}
class B : A()
fun box(): String {
val all = A::class.functions.map { it.name }.sorted()
assert(all == listOf("equals", "hashCode", "mem", "memExt", "toString")) { "Fail A functions: ${A::class.functions}" }
val declared = A::class.declaredFunctions.map { it.name }.sorted()
assert(declared == listOf("mem", "memExt")) { "Fail A declaredFunctions: ${A::class.declaredFunctions}" }
val declaredSubclass = B::class.declaredFunctions.map { it.name }.sorted()
assert(declaredSubclass.isEmpty()) { "Fail B declaredFunctions: ${B::class.declaredFunctions}" }
return "OK"
}
@@ -0,0 +1,18 @@
// WITH_REFLECT
import kotlin.test.assertEquals
fun foo() {}
class A {
fun bar() = ""
}
fun Int.baz() = this
fun box(): String {
assertEquals("foo", ::foo.name)
assertEquals("bar", A::bar.name)
assertEquals("baz", Int::baz.name)
return "OK"
}