Groupped tests by folders
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
var result: String? = null
|
||||
MainLoop@
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
if (line.isNotBlank()) {
|
||||
result = line
|
||||
break@MainLoop
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
val <caret>result: String? = list
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
val <caret>result: String? = list
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
if (line.isBlank()) continue
|
||||
return line
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { !it.isBlank() }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { !it.isBlank() }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableList<String>) {
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
target.add(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableList<String>) {
|
||||
<caret>list.flatMapTo(target) { it.lines() }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableList<String>) {
|
||||
<caret>list
|
||||
.asSequence()
|
||||
.flatMapTo(target) { it.lines().asSequence() }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val target = ArrayList<String>(100)
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
target.add(line)
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val <caret>target = list.flatMapTo(ArrayList<String>(100)) { it.lines() }
|
||||
return target
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
import java.util.ArrayList
|
||||
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val <caret>target = list
|
||||
.asSequence()
|
||||
.flatMapTo(ArrayList<String>(100)) { it.lines().asSequence() }
|
||||
return target
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val target = createCollection()
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
target.add(line)
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
fun createCollection() = java.util.ArrayList<String>()
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val target = createCollection()
|
||||
<caret>list.flatMapTo(target) { it.lines() }
|
||||
return target
|
||||
}
|
||||
|
||||
fun createCollection() = java.util.ArrayList<String>()
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMapTo(){}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val target = createCollection()
|
||||
<caret>list
|
||||
.asSequence()
|
||||
.flatMapTo(target) { it.lines().asSequence() }
|
||||
return target
|
||||
}
|
||||
|
||||
fun createCollection() = java.util.ArrayList<String>()
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>for ((index, s) in list.withIndex()) {
|
||||
for (line in s.lines().take(index)) {
|
||||
if (line.isNotBlank()) return line
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.mapIndexed { index, s -> s.lines().take(index) }
|
||||
.flatMap { it }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.lines().take(index) }
|
||||
.flatMap { it.asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
if (line.isNotBlank() && line.length < s.length / 10) return line
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): Char? {
|
||||
<caret>for (s in list) {
|
||||
for (c in s) {
|
||||
if (c != ' ') return c
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
if (line.isNotBlank()) return line
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'flatMap{}.firstOrNull{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): String? {
|
||||
var result: String? = null
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
if (line.isNotBlank()) {
|
||||
result = line
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): String? {
|
||||
OuterLoop@
|
||||
<caret>for (s in list) {
|
||||
for (line in s.lines()) {
|
||||
if (line.isBlank()) continue@OuterLoop
|
||||
return line
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user