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:
+36
@@ -0,0 +1,36 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_REFLECT
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public static String x;
|
||||
|
||||
static String packageLocalField;
|
||||
}
|
||||
|
||||
// FILE: K.kt
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
val f = J::x
|
||||
assertEquals("x", f.name)
|
||||
|
||||
assertEquals(f, J::class.members.single { it.name == "x" })
|
||||
|
||||
f.set("OK")
|
||||
assertEquals("OK", J.x)
|
||||
assertEquals("OK", f.getter())
|
||||
|
||||
val pl = J::packageLocalField.getter
|
||||
try {
|
||||
pl()
|
||||
return "Fail: package local field must be inaccessible"
|
||||
} catch (e: Exception) {
|
||||
// OK
|
||||
}
|
||||
|
||||
return f.get()
|
||||
}
|
||||
Reference in New Issue
Block a user