[Tests] Migrate backend-independent tests from native to compiler/testData.

^KT-65979
This commit is contained in:
Vladimir Sukharev
2024-02-25 18:25:58 +01:00
committed by Space Team
parent dd9332d9e1
commit febac0dd5f
640 changed files with 68168 additions and 6313 deletions
@@ -1,17 +0,0 @@
/*
* Copyright 2010-2021 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.
*/
import kotlin.test.*
fun interface Foo {
fun invoke(): String
}
fun foo(f: Foo) = f is Function<*>
fun box(): String {
assertFalse(foo { "zzz" })
return "OK"
}
@@ -1,23 +0,0 @@
/*
* Copyright 2010-2021 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.
*/
import kotlin.test.*
interface A<T>
// https://youtrack.jetbrains.com/issue/KT-49384
class B<T> {
init {
mutableListOf<A<out T>>()
.sortWith { _, _ -> 1 }
}
}
fun box(): String {
val b = B<Any>()
assertEquals(b, b) // Just to ensure B is not deleted by DCE
return "OK"
}
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2021 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.
*/
import kotlin.test.*
interface A<T>
// https://youtrack.jetbrains.com/issue/KT-49384
fun interface Foo<T> {
fun same(obj: T): T
}
fun getSame(obj: A<out Any>, foo: Foo<A<out Any>>) = foo.same(obj)
fun box(): String {
val obj = object : A<Any> {}
assertSame(obj, getSame(obj) { it })
return "OK"
}
@@ -1,15 +0,0 @@
/*
* Copyright 2010-2021 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.
*/
import kotlin.test.*
fun <T> foo(comparator: kotlin.Comparator<in T>, a: T, b: T) = comparator.compare(a, b)
fun bar(x: Int, y: Int) = foo<Int> ({ a, b -> a - b}, x, y)
fun box(): String {
assertTrue(bar(42, 117) < 0)
return "OK"
}