Move all basic completion tests to common folder

This commit is contained in:
Nikolay Krasko
2013-04-11 17:33:24 +04:00
parent 7f8e0e8803
commit 87c9a65667
74 changed files with 256 additions and 246 deletions
@@ -0,0 +1,14 @@
trait Expr
class Num(val value : Int) : Expr
fun eval(e : Expr) {
if (e is Num) {
return e.<caret>
}
}
// EXIST: value
@@ -0,0 +1,12 @@
class Expr {}
class Num : Expr() {
fun testing() {}
}
fun eval(e : Expr) {
if (e is Num) {
return e.<caret>()
}
}
// EXIST: testing
@@ -0,0 +1,11 @@
trait Expr {
public fun testThis() {
if (this is Num) {
this.<caret>
}
}
}
class Num(val toCheck : Int) : Expr
// EXIST: toCheck
@@ -0,0 +1,8 @@
trait Expr
class Sum(val left : Expr, val right : Expr) : Expr
fun evalWhen(e : Expr) : Int = when (e) {
is Sum -> e.<caret>
}
// EXIST: left, right
@@ -0,0 +1,5 @@
fun some() {
var a : A<caret>
}
// EXIST: Any
@@ -0,0 +1,5 @@
fun some() {
var a : In<caret>
}
// EXIST: Int
@@ -0,0 +1,19 @@
package testing
fun testTop() {
}
class TestSample() {
fun main(args : Array<String>) {
val testVar = ""
test<caret>.testFun()
}
fun testFun() {
}
}
// TIME: 2
// EXIST: testVar, testFun, testTop
@@ -0,0 +1,11 @@
class TestClass {
public fun testMethod() {
}
}
fun testFun() {
val lambda = {() -> TestClass() }
lambda().<caret>
}
// EXIST: testMethod
@@ -0,0 +1,9 @@
class A {
fun f() : A<caret>
}
class A {
fun f() : A
}
// EXIST: A
@@ -0,0 +1,9 @@
class A {
fun f() : A
}
class A {
fun f() : A<caret>
}
// EXIST: A
@@ -0,0 +1,10 @@
val a: Int = 1
get() {
return $a
}
set(v) {
$a = <caret>
}
// EXIST: a
@@ -0,0 +1,7 @@
/// KT-1187 Wrong unnecessary completion
fun anyfun() {
a.b.c.d.e.f.<caret>
}
// NUMBER: 0
@@ -0,0 +1,13 @@
open class MySecondClass() {
}
open class MyFirstClass<T> {
}
class A() : My<caret> {
public fun test() {
}
}
// EXIST: MySecondClass, MyFirstClass
@@ -0,0 +1,11 @@
package Test.SubTest.AnotherTest
open class TestClass {
}
class A() : Test.SubTest.AnotherTest.Te<caret> {
public fun test() {
}
}
// EXIST: TestClass
@@ -0,0 +1,8 @@
class Test {
val Str<caret>
}
// TIME: 1
// EXIST: String~(jet)
// EXIST: StringBuilder
// EXIST_JAVA_ONLY: StringBuffer
@@ -0,0 +1,11 @@
fun testing() {}
fun S<caret>
// Should complete types for receiver after explicit basic completion call
// TIME: 1
// EXIST: String
// EXIST_JAVA_ONLY: StringBuffer
// EXIST: Set
// ABSENT: testing
@@ -0,0 +1,14 @@
open class Base
class Test
fun <T> Test.extensionEmpty(param: T) = "Test"
fun <T: Base> Test.extensionBase(param: T) = "Test"
fun <T: Base, P> Test.extensionTwo(param: T) = "Test"
fun some() {
Test().ex<caret>
}
// EXIST: extensionEmpty
// EXIST: extensionBase
// EXIST: extensionTwo
@@ -0,0 +1,14 @@
open class Base
open class OtherBase
class Some<T>
fun <TSome : Base, R : Base> Some<TSome>.extensionBase(param: R) = "Test"
fun <TSome : OtherBase, R : OtherBase> Some<TSome>.extensionOtherBase(param: R) = "Test"
fun <TSome> Some<TSome>.extensionExact() = "Test"
fun test() {
Some<Base>().ex<caret>
}
// EXIST: extensionBase, extensionExact
// ABSENT: extensionOtherBase
@@ -0,0 +1,22 @@
open class Base
open class SubBase:Base()
open class SubSubBase:SubBase()
open class OtherBase
fun <T: Base> T.extensionSomeBase() = 12
fun <T: SubBase> T.extensionSomeSubBase() = 12
fun <T: SubSubBase> T.extensionSomeSubSubBase() = 12
fun <T: Base> T?.extensionSomeNull() = 12
fun <T: Base?> T.extensionSomeNullParam() = 12
fun <T: OtherBase> T.extensionSomeOtherBase() = 12
fun some() {
SubBase().extensionSome<caret>
}
// EXIST: extensionSomeBase
// EXIST: extensionSomeSubBase
// EXIST: extensionSomeNull
// EXIST: extensionSomeNullParam
// ABSENT: extensionSomeOtherBase
// ABSENT: extensionSomeSubSubBase
@@ -0,0 +1,11 @@
import java.util.HashSet
open class Base
fun <T: Base> Set<List<T>>.extensionInternal() = 12
fun some() {
HashSet<List<Base>>().ex<caret>
}
// EXIST: extensionInternal
@@ -0,0 +1,18 @@
open class Base
class ManySome<T, U>
fun <P1, P2>ManySome<P1, P2>.testExactGeneralGeneral() = "Some"
fun <P1, P2>ManySome<P1, Int>.testExactGeneralInt() = "Some"
fun <P1, P2>ManySome<Int, Int>.testExactIntInt() = "Some"
fun <P1 : Base, P2>ManySome<P1, Int>.testSubBaseIntInt() = "Some"
fun <P1, P2, P3>ManySome<P1, P2>.testManyGeneralGeneral() = "Some"
fun some() {
ManySome<Int, Int>().test<caret>
}
// EXIST: testExactGeneralGeneral
// EXIST: testExactGeneralInt
// EXIST: testExactIntInt
// EXIST: testManyGeneralGeneral
// ABSENT: testSubBaseIntInt
@@ -0,0 +1,11 @@
package Tests
import java.util.*
fun hello() {
val a = So<caret>
}
// EXIST: SortedSet
// EXIST_JAVA_ONLY: SortedMap
// EXIST_JS_ONLY: JSON
@@ -0,0 +1,7 @@
fun test(a: Int) {}
fun some() {
tes<caret>
}
// EXIST: test@test(a : jet.Int)
@@ -0,0 +1,13 @@
package something
class SomeTempClass {
fun helloWorld() {
}
fun test() {
hello<caret>()
}
}
// EXIST: helloWorld
@@ -0,0 +1,12 @@
val testExternal
class Some(testParam : Int) {
private val myVal : Int
{
val testing = 12
myVal = test<caret>
}
}
// EXIST: testParam, testExternal, testing
@@ -0,0 +1,9 @@
class Test(val testParam : Int) {
val x : Int get() {
val test = 12
return te<caret>
}
}
// EXIST: test
// EXIST: testParam
@@ -0,0 +1,8 @@
package Test
import <caret>
// EXIST: java,
// EXIST_JAVA_ONLY: javax
// EXIST_JS_ONLY: js
// ABSENT: Array, Integer
@@ -0,0 +1,9 @@
class Test {
fun test() {
val some : <caret>
}
}
// EXIST: Any, Nothing, Unit, Int, Number
// EXIST: Array, Hashable
// EXIST_JAVA_ONLY: Math, Thread
@@ -0,0 +1,8 @@
class Test : <caret> {
fun test() {
}
}
// EXIST: Any, Nothing, Unit, Int, Number
// EXIST: Array, Hashable
// EXIST_JAVA_ONLY: Math, Thread
@@ -0,0 +1,12 @@
data class LocalData(val first : Int, val second : Int)
val (localFirst, localSecond) = LocalData(11, 12)
fun test() {
local<caret>
}
// Test that this test won't fail with exception
// Regression for EA-39175
// ABSENT: localFirst, localSecond
@@ -0,0 +1,9 @@
class TestClassName
type TestAlias = TestClassName
val a: Tes<caret>
// Regression for EA-38287 and KT-2758
// EXIST: TestClassName
// ABSENT: TestAlias
@@ -0,0 +1,11 @@
val some = 12
class Some(someParam : Int) {
{
fun internalFun(someInternal : Int) : Int {
return some<caret>
}
}
}
// EXIST: some, someInternal, someParam
@@ -0,0 +1,6 @@
val testing = 12
val test = "Hello"
val more = test<caret>
// EXIST: test, testing
@@ -0,0 +1,10 @@
package Test
import java.util.<caret>
class Test {
}
// EXIST: AbstractList, Date
// EXIST_JAVA_ONLY: Random, concurrent
@@ -0,0 +1,11 @@
val testGlobal = 12
val test : Int get() {
class SomeMore(testParam : Int) {
{
tes<caret>
}
}
}
// EXIST: testGlobal, test, testParam
@@ -0,0 +1,12 @@
fun hello(moParam : Int) : Int {
val more = 12
val test = object {
val sss = mo<caret>
}
return 12
}
// EXIST: more
// EXIST: moParam
@@ -0,0 +1,8 @@
// For KT-2796
fun test() {
val bVal = 1
b<caret>.app().app() // b is not there
}
// EXIST: bVal
@@ -0,0 +1,9 @@
package testdata.kotlin.data
class TestSample() {
fun main(args : Array<String>) {
testdata.kot<caret>lin.data.TestSample()
}
}
// EXIST: kotlin
@@ -0,0 +1,10 @@
package java.ut<caret>il.
import java.util.AbstractList
class Test {
}
// EXIST: util
// NUMBER: 1
@@ -0,0 +1,11 @@
open class PageManager(a: Runnable)
class Tab
class ChromePageManager(): PageManager(object : Runnable {
public override fun run() {
val ab : Ta<caret> = null
}
}) {
}
// EXIST: Tab
@@ -0,0 +1,5 @@
package kttesting<caret>.util
// Test that there won't be package with completion fake suffix
// NUMBER: 0
@@ -0,0 +1,14 @@
public StringMethod() : String {
}
open class StringMy() {
}
public class Test : String<caret> {
}
// EXIST: StringMy
// EXIST: String
// ABSENT: StringMethod
@@ -0,0 +1,6 @@
package Tests
class A : java.<caret>
// EXIST: lang, util, io
// ABSENT: fun, val, var, namespace
@@ -0,0 +1,10 @@
data class TestData(val first: Int, val second: String)
fun f() : TestData = TestData(42, "Second")
fun test() {
val (dataFirst, dataSecond) = f()
d<caret>
}
// EXIST: dataFirst, dataSecond
@@ -0,0 +1,12 @@
package testing
public object SimpleTestClass {
}
fun some() {
S<caret>
}
// EXIST: SimpleTestClass
// EXIST: String
@@ -0,0 +1,12 @@
package testing
class Testing {
}
fun firstFun() {
Testin<caret>
}
// TIME: 1
// EXIST: Testing
// NUMBER: 1
@@ -0,0 +1,5 @@
fun test() {
<caret>
}
// ABSENT: ""
@@ -0,0 +1,8 @@
object NamedObject
fun test() {
val a : Named<caret>
}
// TIME: 2
// ABSENT: NamedObject
@@ -0,0 +1,3 @@
class Test : java.lang.A<caret>
// ABSENT: Annotation
@@ -0,0 +1,9 @@
object A {
fun f() : S<caret>
}
object A {
fun f() : S
}
// EXIST: String
@@ -0,0 +1,9 @@
object A {
fun f() : S
}
object A {
fun f() : S<caret>
}
// EXIST: String
@@ -0,0 +1,9 @@
package first
fun firstFun() {
val a = In<caret>
}
// TIME: 0
// EXIST: Int~(jet)
// ABSENT: Int~(jet.runtime.SharedVar)
@@ -0,0 +1,24 @@
package Test.MyTest
class A {
class object {
public fun testOther() {
}
public fun testOther(a: Boolean) {
}
public fun testOther(a: Int) {
}
}
}
fun testMy() {
A.test<caret>
}
// EXIST: testOther
// NUMBER: 3
@@ -0,0 +1,10 @@
package testing
class Hello() {
fun test() {
val a : S<caret>
}
}
// EXIST: Set, Short, ShortArray
// ABSENT: toString
@@ -0,0 +1,16 @@
fun main(args: Array<String>) {
Array<caret>
}
// TIME: 2
// WITH_ORDER: 1
// EXIST: Array~(jet)
// EXIST_JAVA_ONLY: Array~(java.sql)
// EXIST_JAVA_ONLY: ArrayList~<E> (java.util)
// EXIST_JS_ONLY: ArrayList~(java.util)
// Developer! Every ancient failure of this test is important!
@@ -0,0 +1,8 @@
fun some(a: Double<caret>) {
}
// TIME: 2
// WITH_ORDER: 1
// EXIST: Double~(jet)
// EXIST_JAVA_ONLY: Double~(java.lang)
// EXIST: DoubleArray~(jet)
@@ -0,0 +1,7 @@
package Test.MyTest
fun test() {
Test.<caret>
}
// EXIST: MyTest
@@ -0,0 +1,12 @@
package some;
open class MyClass() {
}
class A() {
public fun test() {
val a : MyC<caret>
}
}
// EXIST: MyClass
@@ -0,0 +1,15 @@
class Some() {
public val testPublic = 12
protected val testProtected = 12
private val testPrivate = 12
val testPackage = 12
}
fun test() {
Some().<caret>
}
// TIME: 1
// EXIST: testPublic, testPackage
// ABSENT: testPrivate, testProtected
@@ -0,0 +1,13 @@
class Some() {
public val testPublic : Int = 12
protected val testProtected : Int = 12
private val testPrivate = 12
val testPackage = 12
}
fun test() {
Some().<caret>
}
// TIME: 2
// EXIST: testPublic, testProtected, testPrivate, testPackage
@@ -0,0 +1,16 @@
class Some() {
public val testPublic = 12
protected val testProtected = 12
private val testPrivate = 12
val testPackage = 12
}
class SomeSubclass : Some() {
fun test() {
<caret>
}
}
// TIME: 1
// EXIST: testPublic, testProtected, testPackage
// ABSENT: testPrivate
@@ -0,0 +1,15 @@
class Some() {
public val testPublic = 12
protected val testProtected = 12
private val testPrivate = 12
val testPackage = 12
}
class SomeSubclass : Some() {
fun test() {
<caret>
}
}
// TIME: 2
// EXIST: testPublic, testProtected, testPackage, testPrivate
@@ -0,0 +1,12 @@
package Test
class Some() {
fun methodName() {
<caret>
}
}
fun Some.first() {
}
// EXIST: first
@@ -0,0 +1,10 @@
class Some() {
fun methodName() {
this.<caret>
}
}
fun Some.first() {
}
// EXIST: first
@@ -0,0 +1,11 @@
fun Some.first() {
}
class Some() {
}
fun Some.second() {
<caret>
}
// EXIST: first, second
@@ -0,0 +1,11 @@
fun Some.first() {
}
class Some() {
}
fun Some.second() {
this.<caret>
}
// EXIST: first, second
@@ -0,0 +1,17 @@
class SomeObject<T, U>() {
var field : T? = null
}
class A {}
class C {}
fun <T: Comparable<T>, U> SomeObject<T, U>.compareTo(other : SomeObject<T, U>) : Int {
return 0;
}
fun some() {
val test = SomeObject<A, A>
test.<caret>
}
// ABSENT: compareTo
@@ -0,0 +1,11 @@
fun Some.simpleKotlinExtension() {
}
class Some() {
}
fun test() {
<caret>
}
// ABSENT: simpleKotlinExtension
@@ -0,0 +1,10 @@
fun <T> Iterable<T>.first() : T? {
return this.iterator()?.next()
}
fun main(args : Array<String>) {
val test = java.util.HashSet<Int>()
test.<caret>
}
// EXIST: first
@@ -0,0 +1,12 @@
fun <T> Some<T>.close() {
}
class Some<T>() {
}
fun test() {
val s = Some<String>()
s.<caret>
}
// EXIST: close
@@ -0,0 +1,12 @@
fun Some.simpleKotlinExtension() {
}
class Some() {
}
fun test() {
val s = Some()
s.<caret>
}
// EXIST: simpleKotlinExtension