[K/N][Tests] Adjust moved tests interfaceCallsNCasts..vector to new infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2023-12-16 23:54:04 +01:00
committed by Space Team
parent 93642020ff
commit bb8a7b6795
163 changed files with 841 additions and 672 deletions
@@ -0,0 +1,46 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// KT-64460: When producing cache, anonymous objects are not extracted from inline functions to module scope, so the following happens
// kotlin.AssertionError: Expected <class codegen.kclass.kclass0.MainKt$1>, actual <class codegen.kclass.kclass0.box$$inlined$getHasFoo$1>.
// IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE
// IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE
package codegen.kclass.kclass0
import kotlin.test.*
import kotlin.reflect.KClass
interface HasFoo {
fun foo(): String
}
private inline fun getHasFoo(s: String) = object : HasFoo {
override fun foo(): String = s
}
fun box(): String {
val hasFoo = getHasFoo("zzz")
checkClass(
hasFoo::class,
expectedQualifiedName = null,
expectedSimpleName = null, // KT-64460: simpleName is explicitly prohibited in NATIVE backend
expectedToStringName = "class codegen.kclass.kclass0.MainKt\$1",
expectedInstance = hasFoo,
expectedNotInstance = Any()
)
return "OK"
}
private fun checkClass(
clazz: KClass<*>,
expectedQualifiedName: String?, expectedSimpleName: String?, expectedToStringName: String,
expectedInstance: Any, expectedNotInstance: Any?
) {
assertEquals(expectedQualifiedName, clazz.qualifiedName)
assertEquals(expectedSimpleName, clazz.simpleName)
assertEquals(expectedToStringName, clazz.toString())
assertTrue(clazz.isInstance(expectedInstance))
if (expectedNotInstance != null) assertTrue(!clazz.isInstance(expectedNotInstance))
}