mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
This patch mutes the following test categories:
* Tests with java dependencies (System class,
java stdlib, jvm-oriented annotations etc).
* Coroutines tests.
* Reflection tests.
* Tests with an inheritance from the standard
collections.
34 lines
1.0 KiB
Kotlin
Vendored
34 lines
1.0 KiB
Kotlin
Vendored
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// IGNORE_BACKEND: JS, NATIVE
|
|
|
|
// WITH_RUNTIME
|
|
|
|
import java.lang.reflect.Method
|
|
import kotlin.test.assertEquals
|
|
|
|
@Retention(AnnotationRetention.RUNTIME)
|
|
annotation class Ann(val x: String)
|
|
|
|
fun foo0(block: () -> Unit) = block.javaClass
|
|
fun foo1(block: (String) -> Unit) = block.javaClass
|
|
|
|
fun testMethod(method: Method, name: String) {
|
|
assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`")
|
|
|
|
for ((index, annotations) in method.getParameterAnnotations().withIndex()) {
|
|
val ann = annotations.filterIsInstance<Ann>().single()
|
|
assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`")
|
|
}
|
|
}
|
|
|
|
fun testClass(clazz: Class<*>, name: String) {
|
|
val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() }
|
|
testMethod(invokes, name)
|
|
}
|
|
|
|
fun box(): String {
|
|
testClass(foo0( @Ann("OK") fun() {} ), "1")
|
|
testClass(foo1( @Ann("OK") fun(@Ann("OK0") x: String) {} ), "2")
|
|
return "OK"
|
|
}
|