Extract Function: Add test data

This commit is contained in:
Alexey Sedunov
2014-04-10 20:09:13 +04:00
parent 4dec0508a6
commit 0d90dcf010
111 changed files with 1596 additions and 13 deletions
@@ -0,0 +1,12 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
fun foo(): Int {
<selection>return a + super<Z>@A.z</selection>
}
}
@@ -0,0 +1,15 @@
public open class Z {
fun zzz() {
}
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
fun foo(): Int {
<selection>super.zzz()
return a + 1</selection>
}
}
@@ -0,0 +1 @@
Cannot extract super-call
@@ -0,0 +1,15 @@
public open class Z {
fun zzz() {
}
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
fun foo(): Int {
<selection>super@A.zzz()
return a + 1</selection>
}
}
@@ -0,0 +1,12 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
fun foo(): Int {
<selection>return a + super.z</selection>
}
}
@@ -0,0 +1 @@
Cannot extract super-call
@@ -0,0 +1,16 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return <selection>this@A.a + this@B.b + this@A.z + this@B.z</selection>
}
}
}
@@ -0,0 +1,20 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + a1.z + b1.z
}
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return i(this@A, this@B)
}
}
}
@@ -0,0 +1,6 @@
class Z(val a: Int)
// NEXT_SIBLING:
fun Z.foo(): Int {
return <selection>this.a</selection> + 1
}
@@ -0,0 +1,10 @@
class Z(val a: Int)
// NEXT_SIBLING:
fun Z.i(): Int {
return a
}
fun Z.foo(): Int {
return i() + 1
}
@@ -0,0 +1,16 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return <selection>a + this.b + this.z</selection>
}
}
}
@@ -0,0 +1,20 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + b1.z
}
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return i(this@A, this)
}
}
}
@@ -0,0 +1,16 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return <selection>a + b + this@A.z + this@B.z</selection>
}
}
}
@@ -0,0 +1,20 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + a1.z + b1.z
}
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return i(this@A, this@B)
}
}
}
@@ -0,0 +1,6 @@
class Z(val a: Int)
// NEXT_SIBLING:
fun Z.foo(): Int {
return <selection>this.a + a</selection> + 1
}
@@ -0,0 +1,10 @@
class Z(val a: Int)
// NEXT_SIBLING:
fun Z.i(): Int {
return a + a
}
fun Z.foo(): Int {
return i() + 1
}
@@ -0,0 +1,6 @@
class Z(val a: Int)
// NEXT_SIBLING:
fun Z.foo(): Int {
return <selection>a</selection> + 1
}
@@ -0,0 +1,10 @@
class Z(val a: Int)
// NEXT_SIBLING:
fun Z.i(): Int {
return a
}
fun Z.foo(): Int {
return i() + 1
}
@@ -0,0 +1,16 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return <selection>a + b + z</selection>
}
}
}
@@ -0,0 +1,20 @@
public open class Z {
val z: Int = 0
}
// NEXT_SIBLING:
fun i(a1: A, b1: A.B): Int {
return a1.a + b1.b + b1.z
}
public class A(): Z() {
var a: Int = 1
public inner class B(): Z() {
var b: Int = 1
fun foo(): Int {
return i(this@A, this@B)
}
}
}
@@ -0,0 +1,15 @@
// NEXT_SIBLING:
class MyClass {
fun test(): Int {
<selection>coFun()
return coProp + 10</selection>
}
class object {
val coProp = 1
fun coFun() {
}
}
}
@@ -0,0 +1,19 @@
// NEXT_SIBLING:
fun i(): Int {
MyClass.coFun()
return MyClass.coProp + 10
}
class MyClass {
fun test(): Int {
return i()
}
class object {
val coProp = 1
fun coFun() {
}
}
}
@@ -0,0 +1,19 @@
// NEXT_SIBLING:
class A {
class B {
fun test(): Int {
<selection>coFun()
return coProp + 10</selection>
}
class object {
val coProp = 1
fun coFun() {
}
}
}
}
@@ -0,0 +1,23 @@
// NEXT_SIBLING:
fun i(): Int {
A.B.coFun()
return A.B.coProp + 10
}
class A {
class B {
fun test(): Int {
return i()
}
class object {
val coProp = 1
fun coFun() {
}
}
}
}
@@ -0,0 +1,4 @@
// NEXT_SIBLING:
fun foo(a: Int, b: Int, c: Int): Int {
return <selection>(a + b*a - c) + b*c</selection>
}
@@ -0,0 +1,8 @@
// NEXT_SIBLING:
fun i(a: Int, b: Int, c: Int): Int {
return (a + b * a - c) + b * c
}
fun foo(a: Int, b: Int, c: Int): Int {
return i(a, b, c)
}
@@ -0,0 +1,12 @@
// NEXT_SIBLING:
public class A() {
fun bar(a: Int, b: Int): Int {
return a + b
}
}
fun foo(a: A, x: Int): Int {
val t = 10
val u = 20
return <selection>a.bar(t - x, u + x)</selection>
}
@@ -0,0 +1,16 @@
// NEXT_SIBLING:
fun i(a: A, t: Int, u: Int, x: Int): Int {
return a.bar(t - x, u + x)
}
public class A() {
fun bar(a: Int, b: Int): Int {
return a + b
}
}
fun foo(a: A, x: Int): Int {
val t = 10
val u = 20
return i(a, t, u, x)
}
@@ -0,0 +1,15 @@
trait Callable<T> {
fun call(): T
}
fun foo(a: Int): Int {
// NEXT_SIBLING:
val o = object: Callable<Int> {
val b: Int = 1
override fun call(): Int {
return <selection>a + b</selection>
}
}
return o.call()
}
@@ -0,0 +1 @@
Cannot extract method since following types are not denotable in the target scope: foo.&lt;no name provided&gt;
@@ -0,0 +1,7 @@
// NEXT_SIBLING:
fun foo(a: Int): Int {
class T(val b: Int)
val t = T(1)
return <selection>a + t.b</selection>
}
@@ -0,0 +1 @@
Cannot extract method since following types are not denotable in the target scope: foo.T