mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 00:21: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.
41 lines
1.3 KiB
Kotlin
Vendored
41 lines
1.3 KiB
Kotlin
Vendored
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// IGNORE_BACKEND: JS, NATIVE
|
|
|
|
// WITH_RUNTIME
|
|
|
|
import kotlin.test.assertEquals
|
|
|
|
@Retention(AnnotationRetention.RUNTIME)
|
|
annotation class Ann(val x: Int)
|
|
class A {
|
|
@Ann(1) fun foo(x: Int, y: Int = 2, z: Int) {}
|
|
|
|
@Ann(1) constructor(x: Int, y: Int = 2, z: Int)
|
|
}
|
|
|
|
class B @Ann(1) constructor(x: Int, y: Int = 2, z: Int) {}
|
|
|
|
fun test(name: String, annotations: Array<out Annotation>) {
|
|
assertEquals(1, annotations.filterIsInstance<Ann>().single().x, "$name[0]")
|
|
}
|
|
|
|
fun box(): String {
|
|
val foo = A::class.java.getDeclaredMethods().first { it.getName() == "foo" }
|
|
test("foo", foo.getDeclaredAnnotations())
|
|
|
|
val fooDefault = A::class.java.getDeclaredMethods().first { it.getName() == "foo\$default" }
|
|
test("foo", foo.getDeclaredAnnotations())
|
|
|
|
val (secondary, secondaryDefault) = A::class.java.getDeclaredConstructors().partition { it.getParameterTypes().size == 3 }
|
|
|
|
test("secondary", secondary[0].getDeclaredAnnotations())
|
|
test("secondary\$default", secondaryDefault[0].getDeclaredAnnotations())
|
|
|
|
val (primary, primaryDefault) = B::class.java.getConstructors().partition { it.getParameterTypes().size == 3 }
|
|
|
|
test("primary", primary[0].getDeclaredAnnotations())
|
|
test("primary\$default", primaryDefault[0].getDeclaredAnnotations())
|
|
|
|
return "OK"
|
|
}
|