Intention tests: add operator modifier in some tests

This commit is contained in:
Natalia Ukhorskaya
2015-12-16 15:43:58 +03:00
parent 2c29f6f5ab
commit ce3d53d2ee
99 changed files with 99 additions and 99 deletions
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun plus(a: Int, vararg b: Int, c: Int = 0) : Int = 0
operator fun plus(a: Int, vararg b: Int, c: Int = 0) : Int = 0
}
val test = Test()
test.p<caret>lus(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun plus(a: Int, vararg b: Int, c: Int = 0) : Int = 0
operator fun plus(a: Int, vararg b: Int, c: Int = 0) : Int = 0
}
val test = Test()
test + 1
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun plus(vararg b: Int, c: Int = 0) : Int = 0
operator fun plus(vararg b: Int, c: Int = 0) : Int = 0
}
val test = Test()
test.p<caret>lus(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun plus(vararg b: Int, c: Int = 0) : Int = 0
operator fun plus(vararg b: Int, c: Int = 0) : Int = 0
}
val test = Test()
test + 1
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun plus(a: Int, b: Int=5): Test = Test()
operator fun plus(a: Int, b: Int=5): Test = Test()
}
val test = Test()
test.pl<caret>us(1)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun plus(a: Int, b: Int=5): Test = Test()
operator fun plus(a: Int, b: Int=5): Test = Test()
}
val test = Test()
test + 1
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '/' operator
fun test() {
class Test {
fun div(a: Int): Test = Test()
operator fun div(a: Int): Test = Test()
}
val test = Test()
test.div<caret>(1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '/' operator
fun test() {
class Test {
fun div(a: Int): Test = Test()
operator fun div(a: Int): Test = Test()
}
val test = Test()
test / 1
@@ -1,6 +1,6 @@
fun test() {
class Test()
fun Test.div(a: Int): Test = Test()
operator fun Test.div(a: Int): Test = Test()
val test = Test()
test.div<caret>(1)
}
@@ -1,6 +1,6 @@
fun test() {
class Test()
fun Test.div(a: Int): Test = Test()
operator fun Test.div(a: Int): Test = Test()
val test = Test()
test / 1
}
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun plus(fn: () -> Test): Test = fn()
operator fun plus(fn: () -> Test): Test = fn()
}
val test = Test()
test.pl<caret>us {
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun plus(fn: () -> Test): Test = fn()
operator fun plus(fn: () -> Test): Test = fn()
}
val test = Test()
test + {
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '-' operator
fun test() {
class Test {
fun minus(a: Int): Test = Test()
operator fun minus(a: Int): Test = Test()
}
val test = Test()
test.min<caret>us(1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '-' operator
fun test() {
class Test {
fun minus(a: Int): Test = Test()
operator fun minus(a: Int): Test = Test()
}
val test = Test()
test - 1
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun plus(a: Int=1, b: Int=2) : Int = 0
operator fun plus(a: Int=1, b: Int=2) : Int = 0
}
val test = Test()
test.p<caret>lus(b=3)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '%' operator
fun test() {
class Test {
fun mod(a: Int): Test = Test()
operator fun mod(a: Int): Test = Test()
}
val test = Test()
test.mod<caret>(1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '%' operator
fun test() {
class Test {
fun mod(a: Int): Test = Test()
operator fun mod(a: Int): Test = Test()
}
val test = Test()
test % 1
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test {
fun plus(a: Int, b: Int): Test = Test()
operator fun plus(a: Int, b: Int): Test = Test()
}
val test = Test()
test.pl<caret>us(1, 2)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '+' operator
fun test() {
class Test {
fun plus(a: Int): Test = Test()
operator fun plus(a: Int): Test = Test()
}
val test = Test()
test.pl<caret>us(1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '+' operator
fun test() {
class Test {
fun plus(a: Int): Test = Test()
operator fun plus(a: Int): Test = Test()
}
val test = Test()
test + 1
@@ -1,6 +1,6 @@
class C {
companion object {
fun plus(s: String): C = C()
operator fun plus(s: String): C = C()
}
}
@@ -1,6 +1,6 @@
class C {
companion object {
fun plus(s: String): C = C()
operator fun plus(s: String): C = C()
}
}
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '..' operator
fun test() {
class Test {
fun rangeTo(a: Int): Test = Test()
operator fun rangeTo(a: Int): Test = Test()
}
val test = Test()
test.rangeTo<caret>(1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '..' operator
fun test() {
class Test {
fun rangeTo(a: Int): Test = Test()
operator fun rangeTo(a: Int): Test = Test()
}
val test = Test()
test..1
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
open class Base {
open fun plus(s: String) = ""
open operator fun plus(s: String) = ""
}
class C : Base() {
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '*' operator
fun test() {
class Test {
fun times(a: Int): Test = Test()
operator fun times(a: Int): Test = Test()
}
val test = Test()
test.time<caret>s(1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '*' operator
fun test() {
class Test {
fun times(a: Int): Test = Test()
operator fun times(a: Int): Test = Test()
}
val test = Test()
test * 1
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test {
fun <T> div(a: Test): T? = a as? T
operator fun <T> div(a: Test): T? = a as? T
}
val test = Test()
test.div<caret><Int>(Test())
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun plus(vararg b: Int, c: Int = 0): Int = 0
operator fun plus(vararg b: Int, c: Int = 0): Int = 0
}
val test = Test()
test.plus<caret>(c=5)
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun plus(vararg b: Int, c: Int = 0): Int = 0
operator fun plus(vararg b: Int, c: Int = 0): Int = 0
}
val test = Test()
test.plus<caret>(0, 1)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun plus(a: Int): Test = Test()
operator fun plus(a: Int): Test = Test()
}
val test = Test()
test.pl<caret>us(a=1)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun plus(a: Int): Test = Test()
operator fun plus(a: Int): Test = Test()
}
val test = Test()
test + 1
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun unaryPlus(vararg a: Int): Test = Test()
operator fun unaryPlus(vararg a: Int): Test = Test()
}
val test = Test()
test.unaryPl<caret>us()
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun unaryPlus(vararg a: Int): Test = Test()
operator fun unaryPlus(vararg a: Int): Test = Test()
}
val test = Test()
+test
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun unaryPlus(a: Int=1): Test = Test()
operator fun unaryPlus(a: Int=1): Test = Test()
}
val test = Test()
test.unaryPl<caret>us()
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun unaryPlus(a: Int=1): Test = Test()
operator fun unaryPlus(a: Int=1): Test = Test()
}
val test = Test()
+test
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test {
fun unaryPlus(fn: () -> Unit): Test = Test()
operator fun unaryPlus(fn: () -> Unit): Test = Test()
}
val test = Test()
test.unaryPl<caret>us {}
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test {
fun unaryPlus(a: Int): Test = Test()
operator fun unaryPlus(a: Int): Test = Test()
}
val test = Test()
test.unaryPl<caret>us(a=1)
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '!' operator
fun test() {
class Test {
fun not(): Test = Test()
operator fun not(): Test = Test()
}
val test = Test()
test.n<caret>ot()
@@ -1,7 +1,7 @@
// INTENTION_TEXT: Replace with '!' operator
fun test() {
class Test {
fun not(): Test = Test()
operator fun not(): Test = Test()
}
val test = Test()
!test
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test {
fun unaryPlus(vararg a: Int): Test = Test()
operator fun unaryPlus(vararg a: Int): Test = Test()
}
val test = Test()
test.unaryPl<caret>us(0)
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test {
fun unaryPlus(a: Int): Test = Test()
operator fun unaryPlus(a: Int): Test = Test()
}
val test = Test()
test.unaryPl<caret>us(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(vararg a: Int, b: Int = 0): Boolean = true
operator fun contains(vararg a: Int, b: Int = 0): Boolean = true
}
val test = Test()
test.contai<caret>ns(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(vararg a: Int, b: Int = 0): Boolean = true
operator fun contains(vararg a: Int, b: Int = 0): Boolean = true
}
val test = Test()
1 in test
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(c: Int, vararg a: Int, b: Int = 0): Boolean = true
operator fun contains(c: Int, vararg a: Int, b: Int = 0): Boolean = true
}
val test = Test()
test.contai<caret>ns(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(c: Int, vararg a: Int, b: Int = 0): Boolean = true
operator fun contains(c: Int, vararg a: Int, b: Int = 0): Boolean = true
}
val test = Test()
1 in test
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int, b: Int=5) : Boolean = true
operator fun contains(a: Int, b: Int=5) : Boolean = true
}
val test = Test()
test.c<caret>ontains(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int, b: Int=5) : Boolean = true
operator fun contains(a: Int, b: Int=5) : Boolean = true
}
val test = Test()
1 in test
@@ -2,7 +2,7 @@ fun <T> doSomething(a: T) {}
fun test() {
class Test{
fun contains(a: Int) : Boolean = true
operator fun contains(a: Int) : Boolean = true
}
val test = Test()
doSomething(test.c<caret>ontains(0).toString())
@@ -2,7 +2,7 @@ fun <T> doSomething(a: T) {}
fun test() {
class Test{
fun contains(a: Int) : Boolean = true
operator fun contains(a: Int) : Boolean = true
}
val test = Test()
doSomething((0 in test).toString())
@@ -1,6 +1,6 @@
fun test() {
class Test()
fun Test.contains(a: Int) : Boolean = true
operator fun Test.contains(a: Int) : Boolean = true
val test = Test()
test.c<caret>ontains(1)
}
@@ -1,6 +1,6 @@
fun test() {
class Test()
fun Test.contains(a: Int) : Boolean = true
operator fun Test.contains(a: Int) : Boolean = true
val test = Test()
1 in test
}
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test()
test.c<caret>ontains {
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test();
{
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test();
test.c<caret>ontains {
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test();
{
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test()
if (true) {
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test()
if (true) {
@@ -2,7 +2,7 @@ fun <T> doSomething(a: T) {}
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test()
doSomething(test.c<caret>ontains { true }.toString())
@@ -2,7 +2,7 @@ fun <T> doSomething(a: T) {}
fun test() {
class Test{
fun contains(fn: () -> Boolean) : Boolean = true
operator fun contains(fn: () -> Boolean) : Boolean = true
}
val test = Test()
doSomething(({ true } in test).toString())
@@ -2,7 +2,7 @@
// ERROR: Cannot find a parameter with this name: c
fun test() {
class Test{
fun contains(a: Int=1, b: Int=2): Boolean = true
operator fun contains(a: Int=1, b: Int=2): Boolean = true
}
val test = Test()
test.c<caret>ontains(c=3)
@@ -2,7 +2,7 @@
// ERROR: No value passed for parameter b
fun test() {
class Test{
fun contains(a: Int, b: Int): Boolean = true
operator fun contains(a: Int, b: Int): Boolean = true
}
val test = Test()
test.cont<caret>ains(0)
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun contains(a: Int=1, b: Int=2) : Boolean = true
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
}
val test = Test()
test.contai<caret>ns(b=3)
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun contains(a: Int, b: Int) : Boolean = true
operator fun contains(a: Int, b: Int) : Boolean = true
}
val test = Test()
test.c<caret>ontains(1, 2)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int) : Boolean = true
operator fun contains(a: Int) : Boolean = true
}
val test = Test()
if (!test.<caret>contains(1)) return
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int) : Boolean = true
operator fun contains(a: Int) : Boolean = true
}
val test = Test()
if (1 !in test) return
@@ -1,6 +1,6 @@
class C {
companion object {
fun contains(s: String) = true
operator fun contains(s: String) = true
}
}
@@ -1,6 +1,6 @@
class C {
companion object {
fun contains(s: String) = true
operator fun contains(s: String) = true
}
}
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int) : Boolean = true
operator fun contains(a: Int) : Boolean = true
}
val test = Test()
test.c<caret>ontains(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int) : Boolean = true
operator fun contains(a: Int) : Boolean = true
}
val test = Test()
1 in test
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
open class Base {
open fun contains(s: String) = true
open operator fun contains(s: String) = true
}
class C : Base() {
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun <T> contains(a: T): Boolean = false
operator fun <T> contains(a: T): Boolean = false
}
val test = Test()
test.contai<caret>ns<Int>(1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun <T> contains(a: T): Boolean = false
operator fun <T> contains(a: T): Boolean = false
}
val test = Test()
1 in test
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun contains(vararg b: Int, c: Int = 0): Boolean = true
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
}
val test = Test()
test.contains<caret>(c=5)
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
fun test() {
class Test{
fun contains(vararg b: Int, c: Int = 0): Boolean = true
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
}
val test = Test()
test.contains<caret>(0, 1)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int=1, b: Int=2) : Boolean = true
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
}
val test = Test()
test.c<caret>ontains(a=5)
@@ -1,6 +1,6 @@
fun test() {
class Test{
fun contains(a: Int=1, b: Int=2) : Boolean = true
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
}
val test = Test()
5 in test
@@ -1,7 +1,7 @@
fun test() {
class Test(val v: Int)
fun Test.invoke(): Unit = Unit
operator fun Test.invoke(): Unit = Unit
Test(1).i<caret>nvoke()
}
@@ -1,7 +1,7 @@
fun test() {
class Test(val v: Int)
fun Test.invoke(): Unit = Unit
operator fun Test.invoke(): Unit = Unit
Test(1)<caret>()
}
@@ -1,7 +1,7 @@
fun test() {
class Test()
fun Test.invoke(): Unit = Unit
operator fun Test.invoke(): Unit = Unit
val test = Test()
test.i<caret>nvoke()
@@ -1,7 +1,7 @@
fun test() {
class Test()
fun Test.invoke(): Unit = Unit
operator fun Test.invoke(): Unit = Unit
val test = Test()
test()
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(fn: () -> Unit) {}
operator fun invoke(fn: () -> Unit) {}
}
val test = Test()
test.i<caret>nvoke {
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(fn: () -> Unit) {}
operator fun invoke(fn: () -> Unit) {}
}
val test = Test()
test {
@@ -2,7 +2,7 @@ fun <T> doSomething(a: T) {}
fun test() {
class Test {
fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test"
operator fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test"
}
val test = Test()
doSomething(test.i<caret>nvoke(1, "a", "b") { })
@@ -2,7 +2,7 @@ fun <T> doSomething(a: T) {}
fun test() {
class Test {
fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test"
operator fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test"
}
val test = Test()
doSomething(test(1, "a", "b") { })
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, b: String) {}
operator fun invoke(a: Int, b: String) {}
}
val test = Test()
test.i<caret>nvoke(b = "s", a = 1)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, b: String) {}
operator fun invoke(a: Int, b: String) {}
}
val test = Test()
test(b = "s", a = 1)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke() {}
operator fun invoke() {}
}
val test = Test()
test.i<caret>nvoke()
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke() {}
operator fun invoke() {}
}
val test = Test()
test()
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun <T> invoke(a: Int) {}
operator fun <T> invoke(a: Int) {}
}
val test = Test()
test.i<caret>nvoke<Int>(0)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun <T> invoke(a: Int) {}
operator fun <T> invoke(a: Int) {}
}
val test = Test()
test<Int>(0)
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun <T> invoke(fn: () -> T) {}
operator fun <T> invoke(fn: () -> T) {}
}
val test = Test()
test.i<caret>nvoke<Int> { 0 }
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun <T> invoke(fn: () -> T) {}
operator fun <T> invoke(fn: () -> T) {}
}
val test = Test()
test<Int> { 0 }
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, fn: () -> Unit) {}
operator fun invoke(a: Int, fn: () -> Unit) {}
}
val test = Test()
test.i<caret>nvoke(0) {
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, fn: () -> Unit) {}
operator fun invoke(a: Int, fn: () -> Unit) {}
}
val test = Test()
test(0) {
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, b: String) {}
operator fun invoke(a: Int, b: String) {}
}
val test = Test()
test.i<caret>nvoke(1, "s")
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, b: String) {}
operator fun invoke(a: Int, b: String) {}
}
val test = Test()
test(1, "s")
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, vararg b: String) {}
operator fun invoke(a: Int, vararg b: String) {}
}
val test = Test()
test.i<caret>nvoke(1, "a", "b")
@@ -1,6 +1,6 @@
fun test() {
class Test {
fun invoke(a: Int, vararg b: String) {}
operator fun invoke(a: Int, vararg b: String) {}
}
val test = Test()
test(1, "a", "b")