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,29 @@
// WITH_REFLECT
package test
import kotlin.reflect.KMutableProperty0
import kotlin.reflect.jvm.kotlinProperty
import kotlin.test.assertEquals
public var publicField = "1"
internal var internalField = "2"
fun testAccessors() {
val packageClass = Class.forName("test.TopLevelFieldReflectionKt")
packageClass.getDeclaredField("publicField").kotlinProperty
checkAccessor(packageClass.getDeclaredField("publicField").kotlinProperty as KMutableProperty0<String>, "1", "3")
checkAccessor(packageClass.getDeclaredField("internalField").kotlinProperty as KMutableProperty0<String>, "2", "4")
}
fun box(): String {
testAccessors()
return "OK"
}
public fun < R> checkAccessor(prop: KMutableProperty0<R>, value: R, newValue: R) {
assertEquals(prop.get(), value, "Property ${prop} has wrong value")
prop.set(newValue)
assertEquals(prop.get(), newValue, "Property ${prop} has wrong value")
}