tests: Update external tests (1.1.2-dev-393)
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
annotation class Foo
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo::class.constructors.single().call()
|
||||
assertEquals(Foo::class, foo.annotationClass)
|
||||
return "OK"
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
annotation class Anno(val klasses: Array<KClass<*>> = arrayOf(String::class, Int::class))
|
||||
|
||||
fun box(): String {
|
||||
val anno = Anno::class.constructors.single().callBy(emptyMap())
|
||||
assertEquals(listOf(String::class, Int::class), anno.klasses.toList())
|
||||
assertEquals("@Anno(klasses=[class java.lang.String, int])", anno.toString())
|
||||
return "OK"
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
// FILE: J.java
|
||||
|
||||
public interface J {
|
||||
@interface NoParams {}
|
||||
|
||||
@interface OneDefault {
|
||||
String s() default "OK";
|
||||
}
|
||||
|
||||
@interface OneNonDefault {
|
||||
String s();
|
||||
}
|
||||
|
||||
@interface TwoParamsOneDefault {
|
||||
String s();
|
||||
int x() default 42;
|
||||
}
|
||||
|
||||
@interface TwoNonDefaults {
|
||||
String string();
|
||||
Class<?> clazz();
|
||||
}
|
||||
|
||||
@interface ManyDefaultParams {
|
||||
int i() default 0;
|
||||
String s() default "";
|
||||
double d() default 3.14;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: K.kt
|
||||
|
||||
import J.*
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFails
|
||||
|
||||
inline fun <reified T : Annotation> create(args: Map<String, Any?>): T {
|
||||
val ctor = T::class.constructors.single()
|
||||
return ctor.callBy(args.mapKeys { entry -> ctor.parameters.single { it.name == entry.key } })
|
||||
}
|
||||
|
||||
inline fun <reified T : Annotation> create(): T = create(emptyMap())
|
||||
|
||||
fun box(): String {
|
||||
create<NoParams>()
|
||||
|
||||
val t1 = create<OneDefault>()
|
||||
assertEquals("OK", t1.s)
|
||||
assertFails { create<OneDefault>(mapOf("s" to 42)) }
|
||||
|
||||
val t2 = create<OneNonDefault>(mapOf("s" to "OK"))
|
||||
assertEquals("OK", t2.s)
|
||||
assertFails { create<OneNonDefault>() }
|
||||
|
||||
val t3 = create<TwoParamsOneDefault>(mapOf("s" to "OK"))
|
||||
assertEquals("OK", t3.s)
|
||||
assertEquals(42, t3.x)
|
||||
val t4 = create<TwoParamsOneDefault>(mapOf("s" to "OK", "x" to 239))
|
||||
assertEquals(239, t4.x)
|
||||
assertFails { create<TwoParamsOneDefault>(mapOf("s" to "Fail", "x" to "Fail")) }
|
||||
|
||||
assertFails("KClass (not Class) instances should be passed as arguments") {
|
||||
create<TwoNonDefaults>(mapOf("clazz" to String::class.java, "string" to "Fail"))
|
||||
}
|
||||
|
||||
val t5 = create<TwoNonDefaults>(mapOf("clazz" to String::class, "string" to "OK"))
|
||||
assertEquals("OK", t5.string)
|
||||
|
||||
val t6 = create<ManyDefaultParams>()
|
||||
assertEquals(0, t6.i)
|
||||
assertEquals("", t6.s)
|
||||
assertEquals(3.14, t6.d)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFails
|
||||
|
||||
annotation class NoParams
|
||||
annotation class OneDefault(val s: String = "OK")
|
||||
annotation class OneNonDefault(val s: String)
|
||||
annotation class TwoParamsOneDefault(val s: String, val x: Int = 42)
|
||||
annotation class TwoParamsOneDefaultKClass(val string: String, val klass: KClass<*> = Number::class)
|
||||
annotation class TwoNonDefaults(val string: String, val klass: KClass<*>)
|
||||
|
||||
|
||||
inline fun <reified T : Annotation> create(args: Map<String, Any?>): T {
|
||||
val ctor = T::class.constructors.single()
|
||||
return ctor.callBy(args.mapKeys { entry -> ctor.parameters.single { it.name == entry.key } })
|
||||
}
|
||||
|
||||
inline fun <reified T : Annotation> create(): T = create(emptyMap())
|
||||
|
||||
fun box(): String {
|
||||
create<NoParams>()
|
||||
|
||||
val t1 = create<OneDefault>()
|
||||
assertEquals("OK", t1.s)
|
||||
assertFails { create<OneDefault>(mapOf("s" to 42)) }
|
||||
|
||||
val t2 = create<OneNonDefault>(mapOf("s" to "OK"))
|
||||
assertEquals("OK", t2.s)
|
||||
assertFails { create<OneNonDefault>() }
|
||||
|
||||
val t3 = create<TwoParamsOneDefault>(mapOf("s" to "OK"))
|
||||
assertEquals("OK", t3.s)
|
||||
assertEquals(42, t3.x)
|
||||
val t4 = create<TwoParamsOneDefault>(mapOf("s" to "OK", "x" to 239))
|
||||
assertEquals(239, t4.x)
|
||||
assertFails { create<TwoParamsOneDefault>(mapOf("s" to "Fail", "x" to "Fail")) }
|
||||
|
||||
val t5 = create<TwoParamsOneDefaultKClass>(mapOf("string" to "OK"))
|
||||
assertEquals(Number::class, t5.klass)
|
||||
|
||||
assertFails("KClass (not Class) instances should be passed as arguments") {
|
||||
create<TwoNonDefaults>(mapOf("klass" to String::class.java, "string" to "Fail"))
|
||||
}
|
||||
|
||||
val t6 = create<TwoNonDefaults>(mapOf("klass" to String::class, "string" to "OK"))
|
||||
return t6.string
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
// FILE: J.java
|
||||
|
||||
public interface J {
|
||||
@interface NoParams {}
|
||||
|
||||
@interface OneDefault {
|
||||
String foo() default "foo";
|
||||
}
|
||||
|
||||
@interface OneDefaultValue {
|
||||
String value() default "value";
|
||||
}
|
||||
|
||||
@interface OneNonDefault {
|
||||
String foo();
|
||||
}
|
||||
|
||||
@interface OneNonDefaultValue {
|
||||
String value();
|
||||
}
|
||||
|
||||
@interface TwoParamsOneDefault {
|
||||
String string();
|
||||
Class<?> clazz() default Object.class;
|
||||
}
|
||||
|
||||
@interface TwoParamsOneValueOneDefault {
|
||||
String value();
|
||||
Class<?> clazz() default Object.class;
|
||||
}
|
||||
|
||||
@interface TwoNonDefaults {
|
||||
String string();
|
||||
Class<?> clazz();
|
||||
}
|
||||
|
||||
@interface ManyDefaults {
|
||||
int i() default 0;
|
||||
String s() default "";
|
||||
double d() default 3.14;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: K.kt
|
||||
|
||||
import J.*
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFails
|
||||
|
||||
inline fun <reified T : Annotation> create(vararg args: Any?): T =
|
||||
T::class.constructors.single().call(*args)
|
||||
|
||||
fun box(): String {
|
||||
create<NoParams>()
|
||||
|
||||
assertFails { create<OneDefault>() }
|
||||
assertFails { create<OneDefault>("") }
|
||||
assertFails { create<OneDefault>("", "") }
|
||||
|
||||
assertFails { create<OneDefaultValue>() }
|
||||
create<OneDefaultValue>("")
|
||||
assertFails { create<OneDefaultValue>("", "") }
|
||||
|
||||
assertFails { create<OneNonDefault>() }
|
||||
assertFails { create<OneNonDefault>("") }
|
||||
|
||||
assertFails { create<OneNonDefaultValue>() }
|
||||
create<OneNonDefaultValue>("")
|
||||
|
||||
assertFails { create<TwoParamsOneDefault>() }
|
||||
assertFails { create<TwoParamsOneDefault>("") }
|
||||
assertFails { create<TwoParamsOneDefault>("", Any::class) }
|
||||
assertFails { create<TwoParamsOneDefault>(Any::class, "") }
|
||||
|
||||
assertFails { create<TwoParamsOneValueOneDefault>() }
|
||||
assertFails { create<TwoParamsOneValueOneDefault>("") }
|
||||
assertFails { create<TwoParamsOneValueOneDefault>("", Any::class) }
|
||||
assertFails { create<TwoParamsOneValueOneDefault>(Any::class, "") }
|
||||
|
||||
assertFails { create<TwoNonDefaults>("", Any::class) }
|
||||
assertFails { create<TwoNonDefaults>(Any::class, "") }
|
||||
|
||||
assertFails { create<ManyDefaults>() }
|
||||
assertFails { create<ManyDefaults>(42, "Fail", 2.72) }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFails
|
||||
|
||||
annotation class NoParams
|
||||
annotation class OneDefault(val s: String = "Fail")
|
||||
annotation class TwoNonDefaults(val string: String, val klass: KClass<*>)
|
||||
|
||||
inline fun <reified T : Annotation> create(vararg args: Any?): T =
|
||||
T::class.constructors.single().call(*args)
|
||||
|
||||
fun box(): String {
|
||||
create<NoParams>()
|
||||
assertFails { create<NoParams>("Fail") }
|
||||
|
||||
assertFails { create<OneDefault>() }
|
||||
assertFails { create<OneDefault>(42) }
|
||||
val o = create<OneDefault>("OK")
|
||||
assertEquals("OK", o.s)
|
||||
|
||||
assertFails("call() should fail because arguments were passed in an incorrect order") {
|
||||
create<TwoNonDefaults>(Any::class, "Fail")
|
||||
}
|
||||
assertFails("call() should fail because KClass (not Class) instances should be passed as arguments") {
|
||||
create<TwoNonDefaults>("Fail", Any::class.java)
|
||||
}
|
||||
|
||||
val k = create<TwoNonDefaults>("OK", Int::class)
|
||||
assertEquals(Int::class, k.klass)
|
||||
|
||||
return k.string
|
||||
}
|
||||
backend.native/tests/external/codegen/box/reflection/createAnnotation/createJdkAnnotationInstance.kt
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
val ctor = Retention::class.constructors.single()
|
||||
val r = ctor.callBy(mapOf(
|
||||
ctor.parameters.single { it.name == "value" } to RetentionPolicy.RUNTIME
|
||||
))
|
||||
assertEquals(RetentionPolicy.RUNTIME, r.value as RetentionPolicy)
|
||||
assertEquals(Retention::class.java.classLoader, r.javaClass.classLoader)
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
annotation class Foo(val value: String)
|
||||
|
||||
annotation class Anno(
|
||||
val level: DeprecationLevel,
|
||||
val klass: KClass<*>,
|
||||
val foo: Foo,
|
||||
val levels: Array<DeprecationLevel>,
|
||||
val klasses: Array<KClass<*>>,
|
||||
val foos: Array<Foo>
|
||||
)
|
||||
|
||||
@Anno(
|
||||
DeprecationLevel.WARNING,
|
||||
Number::class,
|
||||
Foo("OK"),
|
||||
arrayOf(DeprecationLevel.WARNING),
|
||||
arrayOf(Number::class),
|
||||
arrayOf(Foo("OK"))
|
||||
)
|
||||
fun foo() {}
|
||||
|
||||
fun box(): String {
|
||||
// Construct an annotation with exactly the same parameters, check that the proxy created by Kotlin and by Java reflection are the same and have the same hash code
|
||||
val a1 = Anno::class.constructors.single().call(
|
||||
DeprecationLevel.WARNING,
|
||||
Number::class,
|
||||
Foo::class.constructors.single().call("OK"),
|
||||
arrayOf(DeprecationLevel.WARNING),
|
||||
arrayOf(Number::class),
|
||||
arrayOf(Foo::class.constructors.single().call("OK"))
|
||||
)
|
||||
val a2 = ::foo.annotations.single() as Anno
|
||||
|
||||
assertEquals(a1, a2)
|
||||
assertEquals(a2, a1)
|
||||
assertEquals(a1.hashCode(), a2.hashCode())
|
||||
|
||||
assertEquals("@Anno(level=WARNING, klass=class java.lang.Number, foo=@Foo(value=OK), " +
|
||||
"levels=[WARNING], klasses=[class java.lang.Number], foos=[@Foo(value=OK)])", a1.toString())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
package test
|
||||
|
||||
annotation class A
|
||||
annotation class B(val s: String)
|
||||
|
||||
@A
|
||||
@B("2")
|
||||
fun javaReflectionAnnotationInstances() {}
|
||||
|
||||
fun box(): String {
|
||||
val createA = A::class.constructors.single()
|
||||
|
||||
val a1 = createA.call()
|
||||
if (a1.toString() != "@test.A()") return "Fail: toString does not correspond to the documentation of java.lang.annotation.Annotation#toString: $a1"
|
||||
|
||||
val a2 = createA.call()
|
||||
if (a1 === a2) return "Fail: instances created by the constructor should be different"
|
||||
if (a1 != a2) return "Fail: any instance of A should be equal to any other instance of A"
|
||||
if (a1.hashCode() != a2.hashCode()) return "Fail: hash codes of equal instances should be equal"
|
||||
if (a1.hashCode() != 0) return "Fail: hashCode does not correspond to the documentation of java.lang.annotation.Annotation#hashCode: ${a1.hashCode()}"
|
||||
|
||||
val createB = B::class.constructors.single()
|
||||
val b1 = createB.call("1")
|
||||
if (b1.toString() != "@test.B(s=1)") return "Fail: toString does not correspond to the documentation of java.lang.annotation.Annotation#toString: $b1"
|
||||
if (b1 != b1) return "Fail: instance should be equal to itself"
|
||||
|
||||
val b2 = createB.call("2")
|
||||
if (b1 == b2) return "Fail: instances with different data should not be equal"
|
||||
if (b1.hashCode() == b2.hashCode()) return "Fail: hash codes of different instances should very likely be also different"
|
||||
|
||||
val a3 = ::javaReflectionAnnotationInstances.annotations.filterIsInstance<A>().single()
|
||||
if (a1 === a3) return "Fail: instance created by the constructor and the one obtained from Java reflection should be different"
|
||||
if (a1 != a3) return "Fail: instance created by the constructor should be equal to the one obtained from Java reflection"
|
||||
if (a3 != a1) return "Fail: instance obtained from Java reflection should be equal to the one created by the constructor"
|
||||
if (a1.hashCode() != a3.hashCode()) return "Fail: hash codes of equal instances should be equal"
|
||||
|
||||
val b3 = ::javaReflectionAnnotationInstances.annotations.filterIsInstance<B>().single()
|
||||
if (b2 === b3) return "Fail: instance created by the constructor and the one obtained from Java reflection should be different"
|
||||
if (b2 != b3) return "Fail: instance created by the constructor should be equal to the one obtained from Java reflection"
|
||||
if (b3 != b2) return "Fail: instance obtained from Java reflection should be equal to the one created by the constructor"
|
||||
if (b2.hashCode() != b3.hashCode()) return "Fail: hash codes of equal instances should be equal"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotEquals
|
||||
|
||||
annotation class D(val d: Double)
|
||||
annotation class F(val f: Float)
|
||||
|
||||
/*
|
||||
// TODO: uncomment once KT-13887 is implemented
|
||||
@D(Double.NaN)
|
||||
fun dnan() {}
|
||||
|
||||
@F(Float.NaN)
|
||||
fun fnan() {}
|
||||
*/
|
||||
|
||||
@D(-0.0)
|
||||
fun dMinusZero() {}
|
||||
@D(+0.0)
|
||||
fun dPlusZero() {}
|
||||
|
||||
@F(-0.0f)
|
||||
fun fMinusZero() {}
|
||||
@F(+0.0f)
|
||||
fun fPlusZero() {}
|
||||
|
||||
fun check(x: Any, y: Any) {
|
||||
assertEquals(x, y)
|
||||
assertEquals(y, x)
|
||||
assertEquals(x.hashCode(), y.hashCode())
|
||||
assertEquals(x.toString(), y.toString())
|
||||
}
|
||||
|
||||
fun checkNot(x: Any, y: Any) {
|
||||
assertNotEquals(x, y)
|
||||
assertNotEquals(y, x)
|
||||
assertNotEquals(x.hashCode(), y.hashCode())
|
||||
assertNotEquals(x.toString(), y.toString())
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
/*
|
||||
check(::dnan.annotations.single() as D, D::class.constructors.single().call(Double.NaN))
|
||||
check(::fnan.annotations.single() as F, F::class.constructors.single().call(Float.NaN))
|
||||
*/
|
||||
|
||||
val dmz = D::class.constructors.single().call(-0.0)
|
||||
val dpz = D::class.constructors.single().call(+0.0)
|
||||
val fmz = F::class.constructors.single().call(-0.0f)
|
||||
val fpz = F::class.constructors.single().call(+0.0f)
|
||||
check(::dMinusZero.annotations.single() as D, dmz)
|
||||
check(::dPlusZero.annotations.single() as D, dpz)
|
||||
check(::fMinusZero.annotations.single() as F, fmz)
|
||||
check(::fPlusZero.annotations.single() as F, fpz)
|
||||
|
||||
checkNot(dmz, dpz)
|
||||
checkNot(fmz, fpz)
|
||||
checkNot(dmz, fmz)
|
||||
checkNot(dpz, fpz)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotEquals
|
||||
|
||||
annotation class Anno(val equals: Boolean)
|
||||
|
||||
fun box(): String {
|
||||
val t = Anno::class.constructors.single().call(true)
|
||||
val f = Anno::class.constructors.single().call(false)
|
||||
assertEquals(true, t.equals)
|
||||
assertEquals(false, f.equals)
|
||||
assertNotEquals(t, f)
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
annotation class Anno(
|
||||
val b: Byte,
|
||||
val c: Char,
|
||||
val d: Double,
|
||||
val f: Float,
|
||||
val i: Int,
|
||||
val j: Long,
|
||||
val s: Short,
|
||||
val z: Boolean,
|
||||
val ba: ByteArray,
|
||||
val ca: CharArray,
|
||||
val da: DoubleArray,
|
||||
val fa: FloatArray,
|
||||
val ia: IntArray,
|
||||
val ja: LongArray,
|
||||
val sa: ShortArray,
|
||||
val za: BooleanArray,
|
||||
val str: String,
|
||||
val stra: Array<String>
|
||||
)
|
||||
|
||||
@Anno(
|
||||
1.toByte(),
|
||||
'x',
|
||||
3.14,
|
||||
-2.72f,
|
||||
42424242,
|
||||
239239239239239L,
|
||||
42.toShort(),
|
||||
true,
|
||||
byteArrayOf((-1).toByte()),
|
||||
charArrayOf('y'),
|
||||
doubleArrayOf(-3.14159),
|
||||
floatArrayOf(2.7218f),
|
||||
intArrayOf(424242),
|
||||
longArrayOf(239239239239L),
|
||||
shortArrayOf((-43).toShort()),
|
||||
booleanArrayOf(false, true),
|
||||
"lol",
|
||||
arrayOf("rofl")
|
||||
)
|
||||
fun foo() {}
|
||||
|
||||
fun box(): String {
|
||||
// Construct an annotation with exactly the same parameters, check that the proxy created by Kotlin and by Java reflection are the same and have the same hash code
|
||||
val a1 = Anno::class.constructors.single().call(
|
||||
1.toByte(),
|
||||
'x',
|
||||
3.14,
|
||||
-2.72f,
|
||||
42424242,
|
||||
239239239239239L,
|
||||
42.toShort(),
|
||||
true,
|
||||
byteArrayOf((-1).toByte()),
|
||||
charArrayOf('y'),
|
||||
doubleArrayOf(-3.14159),
|
||||
floatArrayOf(2.7218f),
|
||||
intArrayOf(424242),
|
||||
longArrayOf(239239239239L),
|
||||
shortArrayOf((-43).toShort()),
|
||||
booleanArrayOf(false, true),
|
||||
"lol",
|
||||
arrayOf("rofl")
|
||||
)
|
||||
|
||||
val a2 = ::foo.annotations.single() as Anno
|
||||
|
||||
assertEquals(a1, a2)
|
||||
assertEquals(a2, a1)
|
||||
assertEquals(a1.hashCode(), a2.hashCode())
|
||||
|
||||
assertEquals("@Anno(b=1, c=x, d=3.14, f=-2.72, i=42424242, j=239239239239239, s=42, z=true, " +
|
||||
"ba=[-1], ca=[y], da=[-3.14159], fa=[2.7218], ia=[424242], ja=[239239239239], sa=[-43], za=[false, true], " +
|
||||
"str=lol, stra=[rofl])", a1.toString())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user