Stdlib: run all stdlib tests with JS backend(as possible).
This commit is contained in:
@@ -70,6 +70,10 @@ class CollectionJVMTest {
|
||||
}
|
||||
}
|
||||
|
||||
test fun first() {
|
||||
assertEquals(19, TreeSet(arrayListOf(90, 47, 19)).first())
|
||||
}
|
||||
|
||||
test fun last() {
|
||||
val data = arrayListOf("foo", "bar")
|
||||
assertEquals("bar", data.last())
|
||||
@@ -85,28 +89,19 @@ class CollectionJVMTest {
|
||||
assertTrue(linkedListOf(15, 19, 20).contains(15))
|
||||
}
|
||||
|
||||
test fun sortBy() {
|
||||
expect(arrayListOf("two" to 2, "three" to 3)) {
|
||||
arrayListOf("three" to 3, "two" to 2).sortBy { it.second }
|
||||
}
|
||||
expect(arrayListOf("three" to 3, "two" to 2)) {
|
||||
arrayListOf("three" to 3, "two" to 2).sortBy { it.first }
|
||||
}
|
||||
expect(arrayListOf("two" to 2, "three" to 3)) {
|
||||
arrayListOf("three" to 3, "two" to 2).sortBy { it.first.length }
|
||||
test fun toArray() {
|
||||
val data = arrayListOf("foo", "bar")
|
||||
val arr = data.toArray()
|
||||
println("Got array ${arr}")
|
||||
assertEquals(2, arr.size)
|
||||
todo {
|
||||
assertTrue {
|
||||
arr is Array<String>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
test fun sortFunctionShouldReturnSortedCopyForList() {
|
||||
val list: List<Int> = arrayListOf(2, 3, 1)
|
||||
expect(arrayListOf(1, 2, 3)) { list.sort() }
|
||||
expect(arrayListOf(2, 3, 1)) { list }
|
||||
}
|
||||
|
||||
test fun sortFunctionShouldReturnSortedCopyForIterable() {
|
||||
val list: Iterable<Int> = arrayListOf(2, 3, 1)
|
||||
expect(arrayListOf(1, 2, 3)) { list.sort() }
|
||||
expect(arrayListOf(2, 3, 1)) { list }
|
||||
test fun takeReturnsFirstNElements() {
|
||||
expect(setOf(1, 2)) { sortedSetOf(1, 2, 3, 4, 5).take(2).toSet() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user