Groupped tests by folders

This commit is contained in:
Valentin Kipyatkov
2016-08-18 20:49:28 +03:00
parent d0f6e25783
commit 2d875e516e
392 changed files with 2400 additions and 2148 deletions
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableList()'"
// IS_APPLICABLE_2: false
import java.util.ArrayList
fun foo(map: Map<Int, String>): List<String> {
val result = ArrayList<String>()
<caret>for (s in map.values) {
result.add(s)
}
result.add("")
return result
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableList()'"
// IS_APPLICABLE_2: false
import java.util.ArrayList
fun foo(map: Map<Int, String>): List<String> {
val result = map.values.toMutableList()
result.add("")
return result
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '+='"
// IS_APPLICABLE_2: false
fun foo(list: List<String>, target: MutableList<String>) {
<caret>for (s in list) {
target.add(s)
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '+='"
// IS_APPLICABLE_2: false
fun foo(list: List<String>, target: MutableList<String>) {
<caret>target += list
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<MutableCollection<Int>>) {
<caret>for (collection in list) {
collection.add(collection.size)
}
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
import java.util.ArrayList
var globalCollection = ArrayList<Int>()
fun foo(list: List<Collection<Int>>) {
<caret>for (collection in list) {
globalCollection.add(collection.size)
}
}
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapTo(){}'"
// IS_APPLICABLE_2: false
import java.util.ArrayList
fun foo(list: List<MutableCollection<Int>>) {
var target: MutableCollection<Int>()
target = ArrayList<Int>()
<caret>for (collection in list) {
target.add(collection.size)
}
if (target.size > 100) {
target = ArrayList<Int>()
}
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapTo(){}'"
// IS_APPLICABLE_2: false
import java.util.ArrayList
fun foo(list: List<MutableCollection<Int>>) {
var target: MutableCollection<Int>()
<caret>target = list.mapTo(ArrayList<Int>()) { it.size }
if (target.size > 100) {
target = ArrayList<Int>()
}
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val result = ArrayList<Int>()
<caret>for (s in list) {
if (s.length > result.size) {
result.add(s.hashCode())
}
}
return result
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val result = ArrayList<Int>()
list
.filter { it.length > result.size }
.forEach { result.add(it.hashCode()) }
return result
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val result = ArrayList<Int>()
list
.asSequence()
.filter { it.length > result.size }
.forEach { result.add(it.hashCode()) }
return result
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toList()'"
// IS_APPLICABLE_2: false
import java.util.ArrayList
fun foo(map: Map<Int, String>): List<String> {
val result = ArrayList<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toList()'"
// IS_APPLICABLE_2: false
import java.util.ArrayList
fun foo(map: Map<Int, String>): List<String> {
val <caret>result = map.values.toList()
return result
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toList()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): List<String> {
val result = arrayListOf<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toList()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): List<String> {
val <caret>result = map.values.toList()
return result
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toList()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): List<String> {
val result = mutableListOf<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toList()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): List<String> {
val <caret>result = map.values.toList()
return result
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableSet()'"
// IS_APPLICABLE_2: false
import java.util.HashSet
fun foo(map: Map<Int, String>): MutableCollection<String> {
val result = HashSet<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableSet()'"
// IS_APPLICABLE_2: false
import java.util.HashSet
fun foo(map: Map<Int, String>): MutableCollection<String> {
val <caret>result = map.values.toMutableSet()
return result
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableSet()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): MutableCollection<String> {
val result = hashSetOf<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableSet()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): MutableCollection<String> {
val <caret>result = map.values.toMutableSet()
return result
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableSet()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): MutableCollection<String> {
val result = mutableSetOf<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toMutableSet()'"
// IS_APPLICABLE_2: false
fun foo(map: Map<Int, String>): MutableCollection<String> {
val <caret>result = map.values.toMutableSet()
return result
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toSet()'"
// IS_APPLICABLE_2: false
import java.util.HashSet
fun foo(map: Map<Int, String>): Collection<String> {
val result = HashSet<String>()
<caret>for (s in map.values) {
result.add(s)
}
return result
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'toSet()'"
// IS_APPLICABLE_2: false
import java.util.HashSet
fun foo(map: Map<Int, String>): Collection<String> {
val <caret>result = map.values.toSet()
return result
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.toSet()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.toSet()'"
import java.util.HashSet
fun foo(map: Map<Int, String>): Collection<Int> {
val result = HashSet<Int>()
<caret>for (s in map.values) {
result.add(s.length)
}
return result
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.toSet()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.toSet()'"
import java.util.HashSet
fun foo(map: Map<Int, String>): Collection<Int> {
val <caret>result = map.values
.map { it.length }
.toSet()
return result
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.toSet()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.toSet()'"
import java.util.HashSet
fun foo(map: Map<Int, String>): Collection<Int> {
val <caret>result = map.values
.asSequence()
.map { it.length }
.toSet()
return result
}