Fix functions List<T>.sort() and add sort functions for java.lang.Iterables.

See Problem 3 at https://github.com/JetBrains/kotlin/pull/78#issuecomment-6533534
This commit is contained in:
Alexander Zolotov
2012-06-26 00:36:24 +04:00
parent 1cc7ab6b8d
commit 34f485e45a
3 changed files with 26 additions and 19 deletions
+14 -8
View File
@@ -337,15 +337,21 @@ class CollectionTest {
expect(arrayList(2, 3, 1)) { iterable }
}
test fun sort() {
val coll: List<String> = arrayList("foo", "bar", "abc")
// TODO fixme
// Some sort of in/out variance thing - or an issue with Java interop?
//coll.sort()
test fun sortFunctionShouldReturnSortedCopyForList() {
// TODO fixme Some sort of in/out variance thing - or an issue with Java interop?
todo {
assertEquals(3, coll.size)
assertEquals(arrayList("abc", "bar", "foo"), coll)
// val list : List<Int> = arrayList<Int>(2, 3, 1)
// expect(arrayList(1, 2, 3)) { list.sort() }
// expect(arrayList(2, 3, 1)) { list }
}
}
test fun sortFunctionShouldReturnSortedCopyForIterable() {
// TODO fixme Some sort of in/out variance thing - or an issue with Java interop?
todo {
// val list : java.lang.Iterable<Int> = arrayList(2, 3, 1)
// expect(arrayList(1, 2, 3)) { list.sort() }
// expect(arrayList(2, 3, 1)) { list }
}
}