tests: apply official code style

#KT-38632 Fixed
This commit is contained in:
Dmitry Gridin
2020-04-28 15:51:57 +07:00
parent d8f9643650
commit 11a3482970
406 changed files with 1785 additions and 1525 deletions
@@ -2,37 +2,37 @@
fun test(list: List<Int>): List<Pair<IndexedValue<List<Int>>, IndexedValue<List<Int>>>> {
return list
.asSequence()
.chunked(1)
.distinct()
.distinctBy { it }
.drop(1)
.dropWhile { true }
.filter { true }
.filterIndexed { index, list -> true }
.filterIsInstance<Int>()
.filterNot { true }
.filterNotNull()
.map { it }
.mapIndexed { index, i -> i }
.mapIndexedNotNull { index, i -> i }
.mapNotNull { it }
.minus(1)
.minusElement(1)
.onEach {}
.plus(1)
.plusElement(1)
.requireNoNulls()
.sorted()
.sortedBy { it }
.sortedByDescending { it }
.sortedDescending()
.sortedWith(Comparator { o1, o2 -> 0 })
.take(1)
.takeWhile { true }
.windowed(1, 1, true)
.withIndex()
.zipWithNext()
.zipWithNext { a, b -> a }
.toList()
.asSequence()
.chunked(1)
.distinct()
.distinctBy { it }
.drop(1)
.dropWhile { true }
.filter { true }
.filterIndexed { index, list -> true }
.filterIsInstance<Int>()
.filterNot { true }
.filterNotNull()
.map { it }
.mapIndexed { index, i -> i }
.mapIndexedNotNull { index, i -> i }
.mapNotNull { it }
.minus(1)
.minusElement(1)
.onEach {}
.plus(1)
.plusElement(1)
.requireNoNulls()
.sorted()
.sortedBy { it }
.sortedByDescending { it }
.sortedDescending()
.sortedWith(Comparator { o1, o2 -> 0 })
.take(1)
.takeWhile { true }
.windowed(1, 1, true)
.withIndex()
.zipWithNext()
.zipWithNext { a, b -> a }
.toList()
}
@@ -2,7 +2,7 @@
fun test(list: List<Int>): Int {
return list // comment1
.<caret>filter { it > 1 } // comment2
.map { it * 2 } // comment3
.sum() // comment4
.<caret>filter { it > 1 } // comment2
.map { it * 2 } // comment3
.sum() // comment4
}
@@ -2,8 +2,8 @@
fun test(list: List<Int>): Int {
return list // comment1
.asSequence()
.filter { it > 1 } // comment2
.map { it * 2 } // comment3
.sum() // comment4
.asSequence()
.filter { it > 1 } // comment2
.map { it * 2 } // comment3
.sum() // comment4
}
@@ -2,6 +2,6 @@
fun test(list: List<Int>): List<Int> {
return list // comment1
.<caret>filter { it > 1 } // comment2
.map { it * 2 } // comment3
.<caret>filter { it > 1 } // comment2
.map { it * 2 } // comment3
}
@@ -2,8 +2,8 @@
fun test(list: List<Int>): List<Int> {
return list // comment1
.asSequence()
.filter { it > 1 } // comment2
.map { it * 2 }
.toList() // comment3
.asSequence()
.filter { it > 1 } // comment2
.map { it * 2 }
.toList() // comment3
}
@@ -2,7 +2,7 @@
fun test(list: List<List<Int>>): List<Int> {
return list
.<caret>filter { it.count() > 2 }
.map { it + it }
.flatMap { it + it }
.<caret>filter { it.count() > 2 }
.map { it + it }
.flatMap { it + it }
}
@@ -2,9 +2,9 @@
fun test(list: List<List<Int>>): List<Int> {
return list
.asSequence()
.filter { it.count() > 2 }
.map { it + it }
.toList()
.flatMap { it + it }
.asSequence()
.filter { it.count() > 2 }
.map { it + it }
.toList()
.flatMap { it + it }
}
@@ -2,9 +2,9 @@
fun test(): Int {
return listOf(1, 2, 3)
.<caret>filter { it > 1 }
.map { it * 2 }
.let {
it.binarySearch(1)
}
.<caret>filter { it > 1 }
.map { it * 2 }
.let {
it.binarySearch(1)
}
}
@@ -2,11 +2,11 @@
fun test(): Int {
return listOf(1, 2, 3)
.asSequence()
.filter { it > 1 }
.map { it * 2 }
.toList()
.let {
it.binarySearch(1)
}
.asSequence()
.filter { it > 1 }
.map { it * 2 }
.toList()
.let {
it.binarySearch(1)
}
}
@@ -2,8 +2,8 @@
fun test(list: List<Int>?): List<Int>? {
return list
?.asSequence()
?.filter { it > 1 }
?.map { it * 2 }
?.toList()
?.asSequence()
?.filter { it > 1 }
?.map { it * 2 }
?.toList()
}
@@ -2,11 +2,11 @@
fun test(list: List<Int>): List<Int> {
return list
.asSequence()
.filter { it > 1 }
.mapNotNull {
if (it == 2) return@mapNotNull null
it * 2
}
.toList()
.asSequence()
.filter { it > 1 }
.mapNotNull {
if (it == 2) return@mapNotNull null
it * 2
}
.toList()
}
@@ -3,5 +3,6 @@
// WITH_RUNTIME
fun test(): List<Int> {
return listOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.map { it * 3 }.map { it * 4 }.map { it * 5 }.toList()
return listOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.map { it * 3 }.map { it * 4 }.map { it * 5 }
.toList()
}
@@ -3,8 +3,8 @@
fun test(list: List<Int>): List<Int> {
return list
.filter<caret> { it > 1 }
.map { it * 2 }
.map { it * 3 }
.map { it * 4 }
.filter<caret> { it > 1 }
.map { it * 2 }
.map { it * 3 }
.map { it * 4 }
}
@@ -3,10 +3,10 @@
fun test(list: List<Int>): List<Int> {
return list
.asSequence()
.filter { it > 1 }
.map { it * 2 }
.map { it * 3 }
.map { it * 4 }
.toList()
.asSequence()
.filter { it > 1 }
.map { it * 2 }
.map { it * 3 }
.map { it * 4 }
.toList()
}
@@ -2,9 +2,9 @@
fun test(list: List<Int>): List<Int> {
return list
.reversed()
.<caret>map { it + 1 }
.map { it + 1 }
.dropLast(1)
.takeLast(2)
.reversed()
.<caret>map { it + 1 }
.map { it + 1 }
.dropLast(1)
.takeLast(2)
}
@@ -2,11 +2,11 @@
fun test(list: List<Int>): List<Int> {
return list
.reversed()
.asSequence()
.map { it + 1 }
.map { it + 1 }
.toList()
.dropLast(1)
.takeLast(2)
}
.reversed()
.asSequence()
.map { it + 1 }
.map { it + 1 }
.toList()
.dropLast(1)
.takeLast(2)
}
@@ -2,10 +2,10 @@
fun test(foo: Foo): List<Int> {
return foo.getList()
.asSequence()
.filter { it > 1 }
.map { it * 2 }
.toList()
.asSequence()
.filter { it > 1 }
.map { it * 2 }
.toList()
}
class Foo {
@@ -1,5 +1,6 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
val filterIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }.filterIndexedTo(mutableListOf()) { index, it -> true }
val filterIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }
.filterIndexedTo(mutableListOf()) { index, it -> true }
}
@@ -1,5 +1,6 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
val mapIndexedNotNullTo: MutableList<Int> = list.asSequence().filter { it > 1 }.mapIndexedNotNullTo(mutableListOf()) { index, i -> i }
val mapIndexedNotNullTo: MutableList<Int> = list.asSequence().filter { it > 1 }
.mapIndexedNotNullTo(mutableListOf()) { index, i -> i }
}