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.
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A(param: String) {
|
||||
val int: Int get() = 42
|
||||
val string: String = param
|
||||
var anyVar: Any? = null
|
||||
|
||||
val List<IntRange>.extensionToList: Unit get() {}
|
||||
|
||||
fun notAProperty() {}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val klass = A::class.java.kotlin
|
||||
|
||||
val props = klass.memberProperties
|
||||
|
||||
val names = props.map { it.name }.sorted()
|
||||
assert(names == listOf("anyVar", "int", "string")) { "Fail names: $props" }
|
||||
|
||||
val stringProp = props.firstOrNull { it.name == "string" } ?: return "Fail, string not found: $props"
|
||||
return stringProp.get(A("OK")) as String
|
||||
}
|
||||
Reference in New Issue
Block a user