Created module idea-test-framework and moved classes needed for idea tests there

Moved tests for completion and their test data into module idea-completion
This commit is contained in:
Valentin Kipyatkov
2015-04-13 18:11:53 +03:00
parent 63825c45dd
commit bb808b5620
1303 changed files with 1741 additions and 1733 deletions
@@ -0,0 +1,9 @@
package first
import second.testFun
fun test() {
te<caret>
}
// EXIST: testFun
@@ -0,0 +1,3 @@
package second
fun testFun() : Int = 12
@@ -0,0 +1,9 @@
package first
import second.testFun
fun test() {
te<caret>
}
// EXIST: testFun
@@ -0,0 +1,9 @@
package second
class TestSecond {
fun testMethod() {
}
}
fun testFun() : TestSecond = TestSecond()
@@ -0,0 +1,9 @@
package first
import second.testFun
fun test() {
testFun().<caret>
}
// EXIST: testMethod
@@ -0,0 +1,16 @@
package second
open class SomeOther() {}
class SomeTest<T> {
fun testingMethod() {
}
}
fun <U : SomeOther> SomeTest<U>.testingUnexpectedFunction() {
}
fun <W : Any> SomeTest<W>.testingExpectedFunction(i : Int) : String {
return ""
}
@@ -0,0 +1,15 @@
package first
trait TestedTrait() {
}
fun firstFun() {
val a = second.SomeTest<TestedTrait>()
a.testing<caret>
}
// EXIST: testingMethod
// EXIST: testingExpectedFunction
// ABSENT: testingUnexpectedFunction
// NUMBER: 2
@@ -0,0 +1,8 @@
package test
enum class EnumTest(val i: Int = 0) {
ENTRY1: EnumTest()
ENTRY2: EnumTest(1)
}
class EAnotherClass
@@ -0,0 +1,8 @@
package test
fun main(args: Array<String>) {
EnumTest.E<caret>
}
// EXIST: ENTRY1, ENTRY2
// ABSENT: EnumTest, EAnotherClass
@@ -0,0 +1,6 @@
package second
import first.FirstClass
fun FirstClass.secondExtension() {
}
@@ -0,0 +1,12 @@
package first
class FirstClass() {
}
fun firstFun() {
val a = FirstClass()
a.<caret>
}
// INVOCATION_COUNT: 2
// EXIST: secondExtension
@@ -0,0 +1,9 @@
package second
class Some
// Two function to prevent automatic insert
fun Some.extensionFunction1(): Int = 12
fun Some.extensionFunction2(): Int = 12
fun foo(): Some = Some()
@@ -0,0 +1,9 @@
package first
// For KT-3102
import second.foo
fun test() = foo().ext<caret>
// EXIST: extensionFunction1, extensionFunction2
@@ -0,0 +1,14 @@
package second
fun String.helloFun() {
}
fun String.helloWithParams(i : Int) : String {
return ""
}
fun String.helloFunPreventAutoInsert() {
}
fun Int.helloFake() {
}
@@ -0,0 +1,12 @@
package first
fun firstFun() {
val a : String? = ""
a.hello<caret>
}
// EXIST: helloFun
// EXIST: helloFunPreventAutoInsert
// EXIST: helloWithParams
// ABSENT: helloFake
// NUMBER: 3
@@ -0,0 +1,4 @@
package other
public val String.extensionPropNotImported: Int
get() = 1
@@ -0,0 +1,11 @@
val String.extensionProp1: Int get() = 1
val String.extensionProp2: Int get() = 1
fun foo(o: Any) {
if (o !is String) return
o.ext<caret>
}
// EXIST: extensionProp1
// EXIST: extensionProp2
// EXIST: extensionPropNotImported
@@ -0,0 +1,7 @@
class TestKotlin
val test = Test<caret>
// EXIST: TestKotlin
// EXIST: TestGroovyNormal
// EXIST: TestGroovyScript
@@ -0,0 +1,2 @@
public class TestGroovyNormal {
}
@@ -0,0 +1,10 @@
package foo
class TestKotlin
val test = Test<caret>
// EXIST: TestKotlin
// EXIST: TestGroovyNormal
// EXIST: TestGroovyScript
// INVOCATION_COUNT: 2
@@ -0,0 +1,4 @@
package nondefault
public class TestGroovyNormal {
}
@@ -0,0 +1,4 @@
package nondefault
public class TestGroovyScript {
}
@@ -0,0 +1,9 @@
package second
class Some {
// Two function to prevent automatic insert
fun testFunction1() : Int = 12
fun testFunction2() : Int = 12
}
fun someWithLiteral(body: (Some) -> Unit): Int = 12
@@ -0,0 +1,11 @@
package first
// For KT-3096 No completion in function literal
import second.someWithLiteral
fun test() {
someWithLiteral({file -> file.testFu<caret>})
}
// EXIST: testFunction1, testFunction2
@@ -0,0 +1,5 @@
public final class R {
public static final class layout {
public static final int main=0x7f020000;
}
}
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
println(R.<caret>)
}
// INVOCATION_COUNT: 1
// EXIST: layout
@@ -0,0 +1,5 @@
package second
public class NotImportedClass
// ALLOW_AST_ACCESS
@@ -0,0 +1,7 @@
package first
class A : NotImported<caret>
// AUTOCOMPLETE_SETTING: true
// EXIST: NotImportedClass
// NUMBER: 1
@@ -0,0 +1,6 @@
package second
import first.OuterClass
fun OuterClass.outerExtension() {
}
@@ -0,0 +1,12 @@
package first
class OuterClass {
class Nested {
fun foo() {
out<caret>
}
}
}
// INVOCATION_COUNT: 2
// ABSENT: outerExtension
@@ -0,0 +1,6 @@
package ppp
class C
fun C.extFun1(){}
fun C.extFun2(){}
@@ -0,0 +1,9 @@
package ppp
fun f() {
C().ext<caret>
}
// EXIST: extFun1
// EXIST: extFun2
// NUMBER: 2
@@ -0,0 +1,13 @@
package second
import first.C
fun String.helloFun() { }
fun String.helloWithParams(i : Int): String = ""
val String.helloProp: Int get() = 1
val C.helloForC: Int get() = 1
fun Int.helloFake() { }
@@ -0,0 +1,14 @@
package first
class C {
fun String.firstFun() {
hello<caret>
}
}
// EXIST: helloFun
// EXIST: helloWithParams
// EXIST: helloProp
// EXIST: helloForC
// ABSENT: helloFake
// NUMBER: 4
@@ -0,0 +1,17 @@
package second
fun String?.helloFun() {
}
fun String.helloWithParams(i : Int) : String {
return ""
}
fun <T: CharSequence> T.helloFunGeneric() {
}
fun Int.helloFake() {
}
fun dynamic.helloDynamic() {
}
@@ -0,0 +1,12 @@
package first
fun firstFun() {
val a = ""
a.<caret>
}
// EXIST: helloFun
// EXIST: helloWithParams
// EXIST: helloFunGeneric
// EXIST: helloDynamic
// ABSENT: helloFake
@@ -0,0 +1,16 @@
package second
fun (() -> Unit)?.helloFun1() {
}
fun Function0<Unit>.helloFun2() {
}
fun ExtensionFunction0<String, Unit>.helloFun3() {
}
fun Function1<String, Unit>.helloFun4() {
}
fun Any.helloAny() {
}
@@ -0,0 +1,12 @@
package first
fun firstFun(p: () -> Unit) {
p.hello<caret>
}
// EXIST: helloFun1
// EXIST: helloFun2
// EXIST: helloAny
// ABSENT: helloFun3
// ABSENT: helloFun4
// NUMBER: 3
@@ -0,0 +1,19 @@
package second
fun (String.() -> Unit)?.helloFun1() {
}
fun Function0<Unit>.helloFun2() {
}
fun ExtensionFunction0<String, Unit>.helloFun3() {
}
fun ExtensionFunction0<Int, Unit>.helloFun4() {
}
fun Function1<String, Unit>.helloFun5() {
}
fun Any.helloAny() {
}
@@ -0,0 +1,13 @@
package first
fun firstFun(p: String.() -> Unit) {
p.hello<caret>
}
// EXIST: helloFun1
// ABSENT: helloFun2
// EXIST: helloFun3
// ABSENT: helloFun4
// ABSENT: helloFun5
// EXIST: helloAny
// NUMBER: 3
@@ -0,0 +1,9 @@
package second
import third.Dependency as MyDependency
fun MyDependency?.helloFun() {
}
fun <T: MyDependency> T.helloFunGeneric() {
}
@@ -0,0 +1,9 @@
package first
fun firstFun(x: third.Dependency) {
x.hello<caret>
}
// EXIST: helloFun
// EXIST: helloFunGeneric
// NUMBER: 2
@@ -0,0 +1,6 @@
package abc
val String.helloProp1: Int get() = 1
val String.helloProp2: Int get() = 2
val Int.helloProp3: Int get() = 3
val helloProp4: Int = 4
@@ -0,0 +1,12 @@
package first
fun firstFun() {
val a = ""
a.hello<caret>
}
// EXIST: { lookupString: "helloProp1", attributes: "bold" }
// EXIST: { lookupString: "helloProp2", attributes: "bold" }
// ABSENT: helloProp3
// ABSENT: helloProp4
// NUMBER: 2
@@ -0,0 +1,8 @@
package test
fun globalFun1(): Int = 1
fun globalFun2(): Int = 1
object Some {
fun globalFun3(): Int = 3
}
@@ -0,0 +1,8 @@
package pack
fun testFun() {
gl<caret>
}
// EXIST: globalFun1, globalFun2
// ABSENT: globalFun3
@@ -0,0 +1,10 @@
package other
import pack.C
fun C.xxx() {}
fun C.yyy(p: Int) {}
fun C.zzz(p1: Int, p2: Int) {}
val C.extensionProp: Int get() = 1
// ALLOW_AST_ACCESS
@@ -0,0 +1,13 @@
package pack
class C
fun f() {
C() <caret>
}
// INVOCATION_COUNT: 2
// ABSENT: "xxx"
// EXIST: { lookupString: "yyy", attributes: "bold" }
// ABSENT: "zzz"
// ABSENT: "extensionProp"
@@ -0,0 +1,10 @@
package some
fun foo(i: Int) = 1
fun test() {
foo(B<caret>)
}
/* KT-3779, KT-2821 */
// INVOCATION_COUNT: 2
// EXIST: Bar
@@ -0,0 +1,6 @@
package javapackage;
// For NotImportedJavaClass.kt
public class Bar {
public static int BAZZ = 1;
}
@@ -0,0 +1,16 @@
package test
object NamedObjectTopLevel1
object NamedObjectTopLevel2
fun some() {
object NamedObjectInFun
}
class Some {
companion object {
object NamedObjectInClassObject
}
}
// ALLOW_AST_ACCESS
@@ -0,0 +1,8 @@
package first
fun testFun() {
NamedObject<caret>
}
// EXIST: NamedObjectTopLevel1, NamedObjectTopLevel2, NamedObjectInClassObject
// ABSENT: NamedObjectInFun
@@ -0,0 +1,11 @@
package test
val globalProp1: Int = 1
var globalProp2: Int = 2
val String.globalExtensionProp: Int get() = 0
fun String.globalExtensionFun(): Int = 0
object Some {
var globalProp3: Int = 3
}
@@ -0,0 +1,10 @@
package pack
fun testFun() {
gl<caret>
}
// EXIST: globalProp1, globalProp2
// ABSENT: globalProp3
// ABSENT: globalExtensionProp
// ABSENT: globalExtensionFun
@@ -0,0 +1,3 @@
package ppp
object SomeObject
@@ -0,0 +1,4 @@
fun foo(): S<caret>
// INVOCATION_COUNT: 2
// EXIST: SomeObject
@@ -0,0 +1,4 @@
package first
fun secondFun() {
}
@@ -0,0 +1,7 @@
package first
fun firstFun() {
s<caret>
}
// EXIST: secondFun