tests: Copy stdlib tests from Kotlin/JVM
This patch copies Kotlin/JVM stdlib tests (libraries/stdlib/test) excepting ones with explicit java dependencies. It also transforms the tests to use them as box-tests.
This commit is contained in:
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun box() {
|
||||
assertEquals(listOf(1, 3, 5), listOf(1, 3, 3, 1, 5, 1, 3).distinct())
|
||||
assertTrue(listOf<Int>().distinct().isEmpty())
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun box() {
|
||||
assertEquals(listOf("some", "cat", "do"), arrayOf("some", "case", "cat", "do", "dog", "it").distinctBy { it.length })
|
||||
assertTrue(charArrayOf().distinctBy { it }.isEmpty())
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun box() {
|
||||
assertTrue(listOf(1, 3).intersect(listOf(5)).none())
|
||||
assertEquals(listOf(5), listOf(1, 3, 5).intersect(listOf(5)).toList())
|
||||
assertEquals(listOf(1, 3, 5), listOf(1, 3, 5).intersect(listOf(1, 3, 5)).toList())
|
||||
assertTrue(listOf<Int>().intersect(listOf(1)).none())
|
||||
}
|
||||
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+21
@@ -0,0 +1,21 @@
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun box() {
|
||||
// lets use a mutable variable
|
||||
var set = setOf("a")
|
||||
val setOriginal = set
|
||||
set += "foo"
|
||||
set += listOf("beer", "a")
|
||||
set += arrayOf("cheese", "beer")
|
||||
set += sequenceOf("bar", "foo")
|
||||
assertEquals(setOf("a", "foo", "beer", "cheese", "bar"), set)
|
||||
assertTrue(set !== setOriginal)
|
||||
|
||||
val mset = mutableSetOf("a")
|
||||
mset += "foo"
|
||||
mset += listOf("beer", "a")
|
||||
mset += arrayOf("cheese", "beer")
|
||||
mset += sequenceOf("bar", "foo")
|
||||
assertEquals(set, mset)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun box() {
|
||||
assertEquals(listOf(1, 3), listOf(1, 3).subtract(listOf(5)).toList())
|
||||
assertEquals(listOf(1, 3), listOf(1, 3, 5).subtract(listOf(5)).toList())
|
||||
assertTrue(listOf(1, 3, 5).subtract(listOf(1, 3, 5)).none())
|
||||
assertTrue(listOf<Int>().subtract(listOf(1)).none())
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
fun box() {
|
||||
assertEquals(listOf(1, 3, 5), listOf(1, 3).union(listOf(5)).toList())
|
||||
assertEquals(listOf(1), listOf<Int>().union(listOf(1)).toList())
|
||||
}
|
||||
Reference in New Issue
Block a user