Fix testData/js: replace deprecated usages: times, sortBy, reverse, splitBy.
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ package foo
|
||||
internal fun test(a: Int, b: Int): Int {
|
||||
var c = 0
|
||||
|
||||
b.times {
|
||||
repeat(b) {
|
||||
c += a
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ val Int.abs: Int
|
||||
get() = if (this >= 0) this else -this
|
||||
|
||||
fun test(xs: List<Int>): List<Int> =
|
||||
xs.sortBy(comparator { a, b -> a.abs.compareTo(b.abs) })
|
||||
xs.sortedWith(comparator { a, b -> a.abs.compareTo(b.abs) })
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(listOf(1, -2, 3, -4), test(listOf(-2, 1, -4, 3)))
|
||||
|
||||
@@ -8,7 +8,7 @@ internal fun test(a: Int, b: Int): Int {
|
||||
with (a + b) {
|
||||
val t = this
|
||||
|
||||
t.times {
|
||||
repeat(t) {
|
||||
res += t - b
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ package foo
|
||||
internal var counter = 0
|
||||
|
||||
internal fun test(a: Int) {
|
||||
a.times {
|
||||
repeat(a) {
|
||||
counter += 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user