[K/N][tests] Migrate link tests to new testing infra ^KT-61259
This commit is contained in:
committed by
Space Team
parent
588549d1d0
commit
d6a922bc74
@@ -0,0 +1,25 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
public fun mangle(l: List<Int>) = "Int direct $l"
|
||||
|
||||
public fun mangle(l: List<out Number>) = "out Number direct $l"
|
||||
|
||||
public fun mangle(l: List<*>) = "star direct $l"
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val mutListInt = mutableListOf<Int>(1, 2, 3, 4)
|
||||
val mutListNum = mutableListOf<Number>(9, 10, 11, 12)
|
||||
val mutListAny = mutableListOf<Any>(5, 6, 7, 8)
|
||||
|
||||
assertEquals("Int direct [1, 2, 3, 4]", mangle(mutListInt))
|
||||
assertEquals("out Number direct [9, 10, 11, 12]", mangle(mutListNum))
|
||||
assertEquals("star direct [5, 6, 7, 8]", mangle(mutListAny))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
public fun <T> mangle(l: T) = "no constructors $l"
|
||||
|
||||
public fun <T> mangle(l: T) where T: Comparable<T> = "single constructor $l"
|
||||
|
||||
public fun <T> mangle(l: T) where T: Comparable<T>, T: Number = "two constructors $l"
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val any = mapOf<Float, Float>()
|
||||
val comparable = "some string"
|
||||
val number = 17
|
||||
|
||||
assertEquals("no constructors {}", mangle(any))
|
||||
assertEquals("single constructor some string", mangle(comparable))
|
||||
assertEquals("two constructors 17", mangle(number))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
public fun <T> mangle(l: T) where T: List<Int> = "Int param $l"
|
||||
|
||||
public fun <T> mangle(l: T) where T: List<out Number> = "out Number param $l"
|
||||
|
||||
public fun <T> mangle(l: T) where T: List<*> = "star param $l"
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val mutListInt = mutableListOf<Int>(1, 2, 3, 4)
|
||||
val mutListNum = mutableListOf<Number>(9, 10, 11, 12)
|
||||
val mutListAny = mutableListOf<Any>(5, 6, 7, 8)
|
||||
|
||||
assertEquals("Int param [1, 2, 3, 4]", mangle(mutListInt))
|
||||
assertEquals("out Number param [9, 10, 11, 12]", mangle(mutListNum))
|
||||
assertEquals("star param [5, 6, 7, 8]", mangle(mutListAny))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user