Fix testData/codegen: replace deprecated sort usages.

This commit is contained in:
Ilya Gorbunov
2015-10-02 19:02:05 +03:00
parent c54ffe39b1
commit 43a74e575e
10 changed files with 15 additions and 15 deletions
@@ -7,7 +7,7 @@ class C @Primary constructor() {
}
fun box(): String {
val ans = C::class.constructors.map { it.annotations.single().annotationType().simpleName }.toSortedList()
val ans = C::class.constructors.map { it.annotations.single().annotationType().simpleName }.sorted()
if (ans != listOf("Primary", "Secondary")) return "Fail: $ans"
return "OK"
}
@@ -11,7 +11,7 @@ class A {
private class PrivateNested
}
fun nestedNames(c: KClass<*>) = c.nestedClasses.map { it.simpleName ?: throw AssertionError("Unnamed class: ${it.java}") }.toSortedList()
fun nestedNames(c: KClass<*>) = c.nestedClasses.map { it.simpleName ?: throw AssertionError("Unnamed class: ${it.java}") }.sorted()
fun box(): String {
// Kotlin class without nested classes
@@ -8,13 +8,13 @@ open class A {
class B : A()
fun box(): String {
val all = A::class.functions.map { it.name }.toSortedList()
val all = A::class.functions.map { it.name }.sorted()
assert(all == listOf("equals", "hashCode", "mem", "memExt", "toString")) { "Fail A functions: ${A::class.functions}" }
val declared = A::class.declaredFunctions.map { it.name }.toSortedList()
val declared = A::class.declaredFunctions.map { it.name }.sorted()
assert(declared == listOf("mem", "memExt")) { "Fail A declaredFunctions: ${A::class.declaredFunctions}" }
val declaredSubclass = B::class.declaredFunctions.map { it.name }.toSortedList()
val declaredSubclass = B::class.declaredFunctions.map { it.name }.sorted()
assert(declaredSubclass.isEmpty()) { "Fail B declaredFunctions: ${B::class.declaredFunctions}" }
return "OK"
@@ -14,8 +14,8 @@ class Sub : Super() {
fun box(): String {
val sub = Sub::class
assertEquals(listOf("a", "c"), sub.memberProperties.map { it.name }.sort())
assertEquals(listOf("b", "d"), sub.memberExtensionProperties.map { it.name }.sort())
assertEquals(listOf("a", "c"), sub.memberProperties.map { it.name }.sorted())
assertEquals(listOf("b", "d"), sub.memberExtensionProperties.map { it.name }.sorted())
assertEquals(listOf("c"), sub.declaredMemberProperties.map { it.name })
assertEquals(listOf("d"), sub.declaredMemberExtensionProperties.map { it.name })
@@ -15,7 +15,7 @@ fun box(): String {
val props = klass.memberProperties
val names = props.map { it.name }.toSortedList()
val names = props.map { it.name }.sorted()
assert(names == listOf("anyVar", "int", "string")) { "Fail names: $props" }
val stringProp = props.firstOrNull { it.name == "string" } ?: return "Fail, string not found: $props"