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,16 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...filter{}.map{}.firstOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
fun foo(list: List<String>, o: Any): Int? {
if (o is Int) {
<caret>for (s in list) {
val length = s.length + o
if (length > 0) {
val x = length * o.hashCode()
return x
}
}
return null
}
return 0
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...filter{}.map{}.firstOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
fun foo(list: List<String>, o: Any): Int? {
if (o is Int) {
return list
.map { it.length + o }
.filter { it > 0 }
.map { it * o.hashCode() }
.firstOrNull()
}
return 0
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...filter{}.map{}.firstOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
fun foo(list: List<String>, o: Any): Int? {
if (o is Int) {
return list
.asSequence()
.map { it.length + o }
.filter { it > 0 }
.map { it * o.hashCode() }
.firstOrNull()
}
return 0
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.firstOrNull{}'"
fun foo(list: List<String>, o: Any): Int? {
if (o is CharSequence) {
<caret>for (s in list) {
val a = s.length + (o as String).capitalize().hashCode()
val x = a * o.length
if (x > 1000) return x
}
return null
}
return 0
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.firstOrNull{}'"
fun foo(list: List<String>, o: Any): Int? {
if (o is CharSequence) {
<caret>return list
.map { it.length + (o as String).capitalize().hashCode() }
.map { it * o.length }
.firstOrNull { it > 1000 }
}
return 0
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.map{}.firstOrNull{}'"
fun foo(list: List<String>, o: Any): Int? {
if (o is CharSequence) {
<caret>return list
.asSequence()
.map { it.length + (o as String).capitalize().hashCode() }
.map { it * o.length }
.firstOrNull { it > 1000 }
}
return 0
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<String>, o: Int?): Int? {
<caret>for (s in list) {
val length = s.length + o!!
if (length > 0) {
val x = length * o
return x
}
}
return null
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...filter{}.map{}.firstOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
fun foo(list: List<String>, o: Any): Int? {
<caret>for (s in list) {
val length = s.length + (o as Int)
if (length > 0) {
val x = length * o.hashCode()
return x
}
}
return null
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...filter{}.map{}.firstOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
fun foo(list: List<String>, o: Any): Int? {
<caret>return list
.map { it.length + (o as Int) }
.filter { it > 0 }
.map { it * o.hashCode() }
.firstOrNull()
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...filter{}.map{}.firstOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
fun foo(list: List<String>, o: Any): Int? {
<caret>return list
.asSequence()
.map { it.length + (o as Int) }
.filter { it > 0 }
.map { it * o.hashCode() }
.firstOrNull()
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<String>, o: Any): Int? {
<caret>for (s in list) {
val length = s.length + (o as Int)
if (length > 0) {
val x = length * o
return x
}
}
return null
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<Any>, o: Any): Int? {
<caret>for (s in list) {
if (s is String && s.length > 0) {
val x = s.length * 2
return x
}
}
return null
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<Any>): String? {
<caret>for (o in list) {
if (bar(o as String)) {
return o
}
}
return null
}
fun bar(s: String): Boolean = true
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<Any>): String? {
var v: String? = null
<caret>for (o in list) {
if (bar(o as String)) {
v = o
break
}
}
return v
}
fun bar(s: String): Boolean = true
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<Any>, target: MutableCollection<String>) {
<caret>for (o in list) {
if (bar(o as String)) {
target.add(o)
}
}
}
fun bar(s: String): Boolean = true
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun Any.foo(list: List<String>): Int? {
<caret>for (s in list) {
if (s.length > 0 && this is String) {
val result = s.length + length
return result
}
}
return null
}