[K/N][tests] Migrate link tests to new testing infra ^KT-61259

This commit is contained in:
Alexander Shabalin
2023-12-20 16:40:03 +01:00
committed by Space Team
parent 588549d1d0
commit d6a922bc74
136 changed files with 1615 additions and 1246 deletions
@@ -1,20 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
sealed class Tag {
abstract fun value(): Any
}
sealed class TagBoolean : Tag() {
abstract override fun value(): Boolean
object True : TagBoolean() {
override fun value() = true
}
object False : TagBoolean() {
override fun value() = false
}
}
@@ -1,9 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
fun main(args: Array<String>) {
val test: TagBoolean = TagBoolean.True
println(test.value())
}
@@ -1,14 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package a
interface A<T> {
fun foo(): T
}
open class C: A<Int> {
override fun foo(): Int = 42
}
@@ -1,17 +0,0 @@
/*
* Copyright 2010-2018 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 a.*
class B: C()
fun main(args: Array<String>) {
val b = B()
println(b.foo())
val c: C = b
println(c.foo())
val a: A<Int> = b
println(a.foo())
}
@@ -1,3 +0,0 @@
42
42
42
@@ -1,19 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package zzz
interface I {
fun foo(): Int
}
open class A : I {
override fun foo() = 42
}
open class B : I by A() {
val x = 117
val y = "zzz"
}
@@ -1,20 +0,0 @@
/*
* Copyright 2010-2018 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 zzz.*
class C : B() {
val a = "qxx"
val b = 123
}
fun main(args: Array<String>) {
val c = C()
println(c.a)
println(c.b)
println(c.foo())
println(c.x)
println(c.y)
}
@@ -1,5 +0,0 @@
qxx
123
42
117
zzz
@@ -1,12 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package zzz
open class B {
val z by lazy { "qzz" }
val x = 117
val zzz = "zzz"
}
@@ -1,18 +0,0 @@
/*
* Copyright 2010-2018 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 zzz.*
class C : B() {
val a = "qxx"
}
fun main(args: Array<String>) {
val c = C()
println(c.a)
println(c.x)
println(c.zzz)
println(c.z)
}
@@ -1,4 +0,0 @@
qxx
117
zzz
qzz
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package a
import kotlin.reflect.KProperty
open class A {
open val x = 42
}
class Delegate {
val f = 117
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
println(p.name)
return f
}
}
open class B: A() {
override val x: Int by Delegate()
fun bar() {
println(super<A>.x)
}
}
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2018 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 a.*
open class C: B() {
override val x: Int = 156
fun foo() {
println(x)
println(super<B>.x)
bar()
}
}
fun main(args: Array<String>) {
val c = C()
c.foo()
}
@@ -1,12 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package a
enum class A(val x: Int) {
Z1(42),
Z2(117),
Z3(-1)
}
@@ -1,12 +0,0 @@
/*
* Copyright 2010-2018 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 a.*
fun main(args: Array<String>) {
println(A.Z1.x)
println(A.valueOf("Z2").x)
println(A.values()[2].x)
}
@@ -1,3 +0,0 @@
42
117
-1
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2022 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.
*/
enum class Foo {
Z;
open fun bar() = 42
}
@@ -1,6 +0,0 @@
/*
* Copyright 2010-2022 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.
*/
fun main() = println(Foo.Z.bar())
@@ -1,3 +0,0 @@
val a = 10
val b = a * 6
val c = a * b * 2
@@ -1 +0,0 @@
fun main() = println(c)
@@ -1,3 +0,0 @@
val a = mutableListOf<Int>()
val b = 1.also { a += 2 }
val c = a.single()
@@ -1 +0,0 @@
fun main() = println(c)
@@ -1,13 +0,0 @@
class A {
val x: Int
init {
var y = 10
fun foo() { y = 42 }
foo()
x = y
}
}
@@ -1,3 +0,0 @@
import kotlin.test.*
fun main() = assertEquals(42, (A().x))
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package a
inline fun foo(x: Int, y: Int = 117) = x + y
@@ -1,11 +0,0 @@
/*
* Copyright 2010-2018 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 a.*
fun main(args: Array<String>) {
println(foo(5))
println(foo(5, 42))
}
@@ -1,13 +0,0 @@
/*
* Copyright 2010-2020 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.
*/
package a
fun foo(n: Int, block: (Int) -> Int): Int {
val arr = IntArray(n) { block(it) }
var sum = 0
for (x in arr) sum += x
return sum
}
@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 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 a.*
import kotlin.test.*
fun main() {
assertEquals(42, foo(7) { it * 2 })
}
@@ -1,7 +0,0 @@
package a
class E(val x: String) {
inner class Inner {
inline fun foo(y: String) = x + y
}
}
@@ -1,5 +0,0 @@
import a.*
fun main() {
println(E("O").Inner().foo("K"))
}
@@ -1,19 +0,0 @@
/*
* Copyright 2010-2020 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.
*/
package a
fun IntArray.forEachNoInline(block: (Int) -> Unit) = this.forEach { block(it) }
inline fun foo(values: IntArray, crossinline block: (Int, Int, Int) -> Int): Int {
val o = object {
lateinit var s: String
var x: Int = 42
}
values.forEachNoInline {
o.x = block(o.x, o.s.length, it)
}
return o.x
}
@@ -1,17 +0,0 @@
/*
* Copyright 2010-2020 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.
*/
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
import a.*
fun main() {
try {
val res = foo(intArrayOf(1, 2, 3)) { x, y, z -> x + y - z }
println(res)
} catch (t: UninitializedPropertyAccessException) {
println("OK")
}
}
@@ -1,16 +0,0 @@
/*
* Copyright 2010-2020 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.
*/
package a
fun IntArray.forEachNoInline(block: (Int) -> Unit) = this.forEach { block(it) }
inline fun fold(initial: Int, values: IntArray, crossinline block: (Int, Int) -> Int): Int {
var res = initial
values.forEachNoInline {
res = block(res, it)
}
return res
}
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2020 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 a.*
fun main() {
println(fold(0, intArrayOf(1, 2, 3)) { x, y -> x + y })
}
@@ -1,13 +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.
*/
open class Outer(val x: Int) {
open inner class Inner1
inner class Middle(x: Int) : Outer(x) {
inner class Inner2 : Inner1() {
fun foo() = this@Outer.x + this@Middle.x
}
}
}
@@ -1,9 +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.
*/
fun main() {
val o = Outer(42).Middle(117).Inner2()
println(o.foo())
}
@@ -1,14 +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.
*/
open class Outer {
open inner class Inner1
inner class Middle {
inner class Inner2 : Inner1() {
fun getOuter() = this@Outer
fun getMiddle() = this@Middle
}
}
}
@@ -1,10 +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.
*/
fun main() {
val o = Outer().Middle().Inner2()
println(o.getOuter() != Outer())
println(o.getMiddle() != Outer().Middle())
}
@@ -1,10 +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.
*/
open class Foo(val z: Int) {
open inner class FooInner {
fun foo() = z
}
}
@@ -1,14 +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.
*/
class Bar : Foo(42) {
inner class BarInner(val x: Int) : FooInner()
}
fun main() {
val o = Bar().BarInner(117)
println(o.x)
println(o.foo())
}
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
open class A {
open inner class Inner {
val x = 42
}
}
@@ -1,12 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
open class B : A() {
open inner class Inner : A.Inner()
}
fun main(args: Array<String>) {
B().Inner()
}
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2018 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.
*/
package a
class A(val x: Int)
@@ -1,14 +0,0 @@
/*
* Copyright 2010-2018 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 a.A
fun main(args: Array<String>) {
val p1 = A::x
println(p1.get(A(42)))
val a = A(117)
val p2 = a::x
println(p2.get())
}