From db40f1ee5a32256fff7228313fdf8770291f1ed9 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Thu, 14 May 2015 17:46:56 +0300 Subject: [PATCH] More reliable testing of keyword completion (introduced directive "NOTHING_ELSE" instead of "NUMBER") --- .../runtimeType/castWithGenerics.kt | 2 +- .../runtimeType/complexHierarchy.kt | 2 +- .../runtimeType/extensionMethod.kt | 2 +- .../codeFragments/runtimeType/runtimeCast.kt | 2 +- .../basic/common/InMiddleOfPackage.kt | 2 +- .../InfixCallNoSpecialLambdaArgumentItem.kt | 2 +- .../basic/common/NoClassNameDuplication.kt | 2 +- .../NoDuplicatedMethodForSmartCast.kt | 2 +- .../namedParameters/InParameterExpression.kt | 2 +- .../namedParameters/OnlyNamedParameters.kt | 2 +- .../WithParameterExpression.kt | 2 +- .../java/ExtensionFromStandardLibrary.kt | 2 +- .../java/NoDuplicationForImportedJavaClass.kt | 2 +- .../java/NoDuplicationForRuntimeClass.kt | 2 +- .../DoNotCompleteWithConstraints.kt | 2 +- .../ExtensionOnNullable.kt | 2 +- .../NoAutoInsertionOfNotImported.kt | 2 +- .../NoExtensionMethodDuplication.kt | 2 +- .../NoGenericFunDuplication.kt | 4 ++-- ...NotImportedExtensionForImplicitReceiver.kt | 2 +- .../NotImportedExtensionFunction2.kt | 2 +- .../NotImportedExtensionFunction3.kt | 2 +- .../NotImportedExtensionFunctionAndAlias.kt | 2 +- .../NotImportedExtensionProperty.kt | 2 +- .../testData/keywords/AfterClassProperty.kt | 3 ++- .../testData/keywords/AfterClasses.kt | 4 +++- .../testData/keywords/AfterFuns.kt | 3 ++- .../testData/keywords/BeforeDelegationCall.kt | 1 + .../testData/keywords/BreakWithLabel.kt | 2 +- .../testData/keywords/CommaExpected.kt | 2 +- .../testData/keywords/ContinueWithLabel.kt | 2 +- .../testData/keywords/FileKeyword.kt | 2 +- .../keywords/GlobalPropertyAccessors.kt | 4 +++- .../testData/keywords/InArgumentList.kt | 2 +- .../testData/keywords/InClassBeforeFun.kt | 3 ++- .../testData/keywords/InClassScope.kt | 3 ++- .../keywords/InClassTypeParameters.kt | 2 +- .../testData/keywords/InCodeBlock.kt | 2 +- .../InConstructorParameterList.kt.todo | 2 +- .../keywords/InFunctionExpressionBody.kt | 2 +- .../keywords/InFunctionTypePosition.kt | 2 +- .../keywords/InGetterExpressionBody.kt | 2 +- .../keywords/InMemberFunParametersList.kt | 2 +- .../keywords/InModifierListInsideClass.kt | 2 +- .../InNotFinishedGenericWithFunAfter.kt | 2 +- .../keywords/InParameterDefaultValue.kt | 2 +- .../keywords/InPropertyInitializer.kt | 2 +- .../keywords/InTopFunParametersList.kt | 2 +- .../keywords/InTopScopeAfterPackage.kt | 4 +++- .../testData/keywords/PrefixMatcher.kt | 2 +- .../testData/keywords/PropertyAccessors.kt | 3 ++- .../testData/keywords/PropertyAccessors2.kt | 3 ++- .../testData/keywords/PropertySetter.kt | 3 ++- .../testData/keywords/QualifiedThis.kt | 2 +- .../keywords/QualifiedThisInAccessor.kt | 2 +- .../testData/keywords/Return1.kt | 2 +- .../testData/keywords/Return6.kt | 2 +- .../idea-completion/testData/keywords/This.kt | 2 +- .../testData/keywords/TopScope.kt | 4 +++- .../testData/smart/AfterEmptyArgument.kt | 2 +- .../testData/smart/AfterNamedArgument.kt | 2 +- .../testData/smart/GroupBySubstitutor.kt | 2 +- idea/idea-completion/testData/smart/Object.kt | 2 +- .../testData/smart/ObjectsFromType.kt | 2 +- .../testData/smart/afterAs/1.kt | 2 +- .../testData/smart/afterAs/2.kt | 2 +- .../testData/smart/afterAs/3.kt | 2 +- .../testData/smart/constructor/InnerClass.kt | 2 +- .../constructor/NoInnerClassInstantiation.kt | 2 +- .../testData/smart/this/QualifiedThis.kt | 2 +- .../InheritorsAndMultipleExpectedTypes.kt | 2 +- .../NoObjectDuplication.kt | 2 +- .../test/AbstractKeywordCompletionTest.kt | 5 ++--- .../completion/test/CompletionTestUtil.kt | 9 +++++---- .../test/ExpectedCompletionUtils.java | 19 ++++++++++++++++++- 75 files changed, 113 insertions(+), 80 deletions(-) diff --git a/idea/idea-completion/testData/basic/codeFragments/runtimeType/castWithGenerics.kt b/idea/idea-completion/testData/basic/codeFragments/runtimeType/castWithGenerics.kt index 5e4e3eb35e7..0fcb4f0a392 100644 --- a/idea/idea-completion/testData/basic/codeFragments/runtimeType/castWithGenerics.kt +++ b/idea/idea-completion/testData/basic/codeFragments/runtimeType/castWithGenerics.kt @@ -16,6 +16,6 @@ class Derived: Base() { // INVOCATION_COUNT: 1 // EXIST: funInBase, funWithOverride, funWithoutOverride -// NUMBER: 3 +// NOTHING_ELSE: true // RUNTIME_TYPE: Derived diff --git a/idea/idea-completion/testData/basic/codeFragments/runtimeType/complexHierarchy.kt b/idea/idea-completion/testData/basic/codeFragments/runtimeType/complexHierarchy.kt index 03a2388b385..5631b424d06 100644 --- a/idea/idea-completion/testData/basic/codeFragments/runtimeType/complexHierarchy.kt +++ b/idea/idea-completion/testData/basic/codeFragments/runtimeType/complexHierarchy.kt @@ -20,6 +20,6 @@ class C: B() { // INVOCATION_COUNT: 2 // EXIST: funA, funAp, funB, funBp, funC, funCp -// NUMBER: 6 +// NOTHING_ELSE: true // RUNTIME_TYPE: C diff --git a/idea/idea-completion/testData/basic/codeFragments/runtimeType/extensionMethod.kt b/idea/idea-completion/testData/basic/codeFragments/runtimeType/extensionMethod.kt index dd9087661ad..5b3a1caa078 100644 --- a/idea/idea-completion/testData/basic/codeFragments/runtimeType/extensionMethod.kt +++ b/idea/idea-completion/testData/basic/codeFragments/runtimeType/extensionMethod.kt @@ -14,7 +14,7 @@ fun Base.funExtBase() { } // INVOCATION_COUNT: 1 // EXIST: funExtBase, funExtDerived -// NUMBER: 2 +// NOTHING_ELSE: true // RUNTIME_TYPE: Derived \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/codeFragments/runtimeType/runtimeCast.kt b/idea/idea-completion/testData/basic/codeFragments/runtimeType/runtimeCast.kt index 6d666c34613..ba9fb4cfe98 100644 --- a/idea/idea-completion/testData/basic/codeFragments/runtimeType/runtimeCast.kt +++ b/idea/idea-completion/testData/basic/codeFragments/runtimeType/runtimeCast.kt @@ -18,7 +18,7 @@ class Derived: Base() { // INVOCATION_COUNT: 1 // EXIST: funInBase, funWithOverride, funWithoutOverride, funInDerived -// NUMBER: 4 +// NOTHING_ELSE: true // RUNTIME_TYPE: Derived \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/common/InMiddleOfPackage.kt b/idea/idea-completion/testData/basic/common/InMiddleOfPackage.kt index 55b048140d8..747b6f9f73b 100644 --- a/idea/idea-completion/testData/basic/common/InMiddleOfPackage.kt +++ b/idea/idea-completion/testData/basic/common/InMiddleOfPackage.kt @@ -7,4 +7,4 @@ class Test { } // EXIST: util -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/common/InfixCallNoSpecialLambdaArgumentItem.kt b/idea/idea-completion/testData/basic/common/InfixCallNoSpecialLambdaArgumentItem.kt index ec3b7617b25..178ce5d8003 100644 --- a/idea/idea-completion/testData/basic/common/InfixCallNoSpecialLambdaArgumentItem.kt +++ b/idea/idea-completion/testData/basic/common/InfixCallNoSpecialLambdaArgumentItem.kt @@ -8,4 +8,4 @@ fun foo() { // EXIST: ext1 // EXIST: ext2 -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/common/NoClassNameDuplication.kt b/idea/idea-completion/testData/basic/common/NoClassNameDuplication.kt index 05b09457aba..67489492dec 100644 --- a/idea/idea-completion/testData/basic/common/NoClassNameDuplication.kt +++ b/idea/idea-completion/testData/basic/common/NoClassNameDuplication.kt @@ -9,4 +9,4 @@ fun firstFun() { // INVOCATION_COUNT: 1 // EXIST: Testing -// NUMBER: 1 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/common/extensions/NoDuplicatedMethodForSmartCast.kt b/idea/idea-completion/testData/basic/common/extensions/NoDuplicatedMethodForSmartCast.kt index 12df2e7b2c2..0b8b89ec875 100644 --- a/idea/idea-completion/testData/basic/common/extensions/NoDuplicatedMethodForSmartCast.kt +++ b/idea/idea-completion/testData/basic/common/extensions/NoDuplicatedMethodForSmartCast.kt @@ -15,4 +15,4 @@ fun g(a: A) { // EXIST: foo // EXIST: foo1 -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/common/namedParameters/InParameterExpression.kt b/idea/idea-completion/testData/basic/common/namedParameters/InParameterExpression.kt index a56aa5640ad..e9053fa909d 100644 --- a/idea/idea-completion/testData/basic/common/namedParameters/InParameterExpression.kt +++ b/idea/idea-completion/testData/basic/common/namedParameters/InParameterExpression.kt @@ -8,4 +8,4 @@ fun test() = small(paramFirst = param) // EXIST: paramTest // ABSENT: {"lookupString":"paramFirst","tailText":" Int","itemText":"paramFirst ="} // ABSENT: paramSecond -// NUMBER: 1 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/common/namedParameters/OnlyNamedParameters.kt b/idea/idea-completion/testData/basic/common/namedParameters/OnlyNamedParameters.kt index a0f5378bbf6..66bcd52b1c0 100644 --- a/idea/idea-completion/testData/basic/common/namedParameters/OnlyNamedParameters.kt +++ b/idea/idea-completion/testData/basic/common/namedParameters/OnlyNamedParameters.kt @@ -7,4 +7,4 @@ fun test(p: Int) = foo(12, third = "", ) // ABSENT: first // ABSENT: third // EXIST: second -// NUMBER: 1 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/common/namedParameters/WithParameterExpression.kt b/idea/idea-completion/testData/basic/common/namedParameters/WithParameterExpression.kt index dbe02b0f671..76cbd6b43c3 100644 --- a/idea/idea-completion/testData/basic/common/namedParameters/WithParameterExpression.kt +++ b/idea/idea-completion/testData/basic/common/namedParameters/WithParameterExpression.kt @@ -9,4 +9,4 @@ fun test() = small(paramFirst = 12) // EXIST: paramSecond // EXIST: paramTest -// NUMBER: 3 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/java/ExtensionFromStandardLibrary.kt b/idea/idea-completion/testData/basic/java/ExtensionFromStandardLibrary.kt index 60021cd39b6..b1ac3f3575a 100644 --- a/idea/idea-completion/testData/basic/java/ExtensionFromStandardLibrary.kt +++ b/idea/idea-completion/testData/basic/java/ExtensionFromStandardLibrary.kt @@ -9,4 +9,4 @@ fun firstFun() { // INVOCATION_COUNT: 1 // EXIST: { lookupString:"toLinkedList", itemText:"toLinkedList", tailText:"() for Iterable in kotlin" } -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/java/NoDuplicationForImportedJavaClass.kt b/idea/idea-completion/testData/basic/java/NoDuplicationForImportedJavaClass.kt index 4d224a78310..d6d045902d3 100644 --- a/idea/idea-completion/testData/basic/java/NoDuplicationForImportedJavaClass.kt +++ b/idea/idea-completion/testData/basic/java/NoDuplicationForImportedJavaClass.kt @@ -4,4 +4,4 @@ val x = InputStreamReader // INVOCATION_COUNT: 2 // EXIST: { lookupString:"InputStreamReader", tailText:" (java.io)" } -// NUMBER: 1 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/java/NoDuplicationForRuntimeClass.kt b/idea/idea-completion/testData/basic/java/NoDuplicationForRuntimeClass.kt index e2b811d0958..9882f91b133 100644 --- a/idea/idea-completion/testData/basic/java/NoDuplicationForRuntimeClass.kt +++ b/idea/idea-completion/testData/basic/java/NoDuplicationForRuntimeClass.kt @@ -2,4 +2,4 @@ val x = LinesSequence // INVOCATION_COUNT: 2 // EXIST: { lookupString:"LinesSequence", tailText:" (kotlin.io)" } -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/DoNotCompleteWithConstraints/DoNotCompleteWithConstraints.kt b/idea/idea-completion/testData/basic/multifile/DoNotCompleteWithConstraints/DoNotCompleteWithConstraints.kt index 2bc456b90ab..863aec8875f 100644 --- a/idea/idea-completion/testData/basic/multifile/DoNotCompleteWithConstraints/DoNotCompleteWithConstraints.kt +++ b/idea/idea-completion/testData/basic/multifile/DoNotCompleteWithConstraints/DoNotCompleteWithConstraints.kt @@ -12,4 +12,4 @@ fun firstFun() { // EXIST: testingExpectedFunction // ABSENT: testingUnexpectedFunction -// NUMBER: 2 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/ExtensionOnNullable/ExtensionOnNullable.kt b/idea/idea-completion/testData/basic/multifile/ExtensionOnNullable/ExtensionOnNullable.kt index 66e065edf74..6de9b9cc2b9 100644 --- a/idea/idea-completion/testData/basic/multifile/ExtensionOnNullable/ExtensionOnNullable.kt +++ b/idea/idea-completion/testData/basic/multifile/ExtensionOnNullable/ExtensionOnNullable.kt @@ -9,4 +9,4 @@ fun firstFun() { // EXIST: helloFunPreventAutoInsert // EXIST: helloWithParams // ABSENT: helloFake -// NUMBER: 3 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NoAutoInsertionOfNotImported/NoAutoInsertionOfNotImported.kt b/idea/idea-completion/testData/basic/multifile/NoAutoInsertionOfNotImported/NoAutoInsertionOfNotImported.kt index 0243d233d2d..be401f8b2b9 100644 --- a/idea/idea-completion/testData/basic/multifile/NoAutoInsertionOfNotImported/NoAutoInsertionOfNotImported.kt +++ b/idea/idea-completion/testData/basic/multifile/NoAutoInsertionOfNotImported/NoAutoInsertionOfNotImported.kt @@ -4,4 +4,4 @@ class A : NotImported // AUTOCOMPLETE_SETTING: true // EXIST: NotImportedClass -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NoExtensionMethodDuplication/NoExtensionMethodDuplication.kt b/idea/idea-completion/testData/basic/multifile/NoExtensionMethodDuplication/NoExtensionMethodDuplication.kt index a278bfdc545..1f737a91564 100644 --- a/idea/idea-completion/testData/basic/multifile/NoExtensionMethodDuplication/NoExtensionMethodDuplication.kt +++ b/idea/idea-completion/testData/basic/multifile/NoExtensionMethodDuplication/NoExtensionMethodDuplication.kt @@ -6,4 +6,4 @@ fun f() { // EXIST: extFun1 // EXIST: extFun2 -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt b/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt index 418e3b654b2..a5734be767f 100644 --- a/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt +++ b/idea/idea-completion/testData/basic/multifile/NoGenericFunDuplication/NoGenericFunDuplication.kt @@ -1,9 +1,9 @@ // this test tests correct substitution equality checking for generic functions -import dependency.pair +import java.io.InputStreamReader fun foo() { 1 pai } // EXIST: pair -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt index 598eb03db2a..bbfafbb3bd0 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionForImplicitReceiver/NotImportedExtensionForImplicitReceiver.kt @@ -11,4 +11,4 @@ class C { // EXIST: helloProp // EXIST: helloForC // ABSENT: helloFake -// NUMBER: 4 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction2/NotImportedExtensionFunction2.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction2/NotImportedExtensionFunction2.kt index e00e1cffc07..54d5ecef3ad 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction2/NotImportedExtensionFunction2.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction2/NotImportedExtensionFunction2.kt @@ -9,4 +9,4 @@ fun firstFun(p: () -> Unit) { // EXIST: helloAny // ABSENT: helloFun3 // ABSENT: helloFun4 -// NUMBER: 3 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction3/NotImportedExtensionFunction3.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction3/NotImportedExtensionFunction3.kt index 791a4483940..d04ab3f1f94 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction3/NotImportedExtensionFunction3.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunction3/NotImportedExtensionFunction3.kt @@ -10,4 +10,4 @@ fun firstFun(p: String.() -> Unit) { // ABSENT: helloFun4 // ABSENT: helloFun5 // EXIST: helloAny -// NUMBER: 3 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunctionAndAlias/NotImportedExtensionFunctionAndAlias.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunctionAndAlias/NotImportedExtensionFunctionAndAlias.kt index b5e4788ba19..de2d252e301 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunctionAndAlias/NotImportedExtensionFunctionAndAlias.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionFunctionAndAlias/NotImportedExtensionFunctionAndAlias.kt @@ -6,4 +6,4 @@ fun firstFun(x: third.Dependency) { // EXIST: helloFun // EXIST: helloFunGeneric -// NUMBER: 2 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionProperty/NotImportedExtensionProperty.kt b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionProperty/NotImportedExtensionProperty.kt index 326a892eaf9..44bade771ee 100644 --- a/idea/idea-completion/testData/basic/multifile/NotImportedExtensionProperty/NotImportedExtensionProperty.kt +++ b/idea/idea-completion/testData/basic/multifile/NotImportedExtensionProperty/NotImportedExtensionProperty.kt @@ -9,4 +9,4 @@ fun firstFun() { // EXIST: { lookupString: "helloProp2", attributes: "bold" } // ABSENT: helloProp3 // ABSENT: helloProp4 -// NUMBER: 2 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/AfterClassProperty.kt b/idea/idea-completion/testData/keywords/AfterClassProperty.kt index 18a204365e7..297ccd66c98 100644 --- a/idea/idea-completion/testData/keywords/AfterClassProperty.kt +++ b/idea/idea-completion/testData/keywords/AfterClassProperty.kt @@ -34,4 +34,5 @@ class MouseMovedEventArgs // EXIST: constructor // EXIST: init /*why?*/ -// NUMBER: 27 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/AfterClasses.kt b/idea/idea-completion/testData/keywords/AfterClasses.kt index 12b69e436dd..b1fd139701f 100644 --- a/idea/idea-completion/testData/keywords/AfterClasses.kt +++ b/idea/idea-completion/testData/keywords/AfterClasses.kt @@ -37,4 +37,6 @@ class B { // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 22 +// EXIST: companion +/*TODO*/ +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/AfterFuns.kt b/idea/idea-completion/testData/keywords/AfterFuns.kt index dbb8e1ce541..12c20e3ea11 100644 --- a/idea/idea-completion/testData/keywords/AfterFuns.kt +++ b/idea/idea-completion/testData/keywords/AfterFuns.kt @@ -37,4 +37,5 @@ class A { // EXIST: constructor // EXIST: init /*why?*/ -// NUMBER: 24 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/BeforeDelegationCall.kt b/idea/idea-completion/testData/keywords/BeforeDelegationCall.kt index 606d774bdb1..caaea42bcc2 100644 --- a/idea/idea-completion/testData/keywords/BeforeDelegationCall.kt +++ b/idea/idea-completion/testData/keywords/BeforeDelegationCall.kt @@ -3,3 +3,4 @@ class A(x: Int) { } // EXIST: this, super +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/BreakWithLabel.kt b/idea/idea-completion/testData/keywords/BreakWithLabel.kt index aafd3ed3bc0..811427586f6 100644 --- a/idea/idea-completion/testData/keywords/BreakWithLabel.kt +++ b/idea/idea-completion/testData/keywords/BreakWithLabel.kt @@ -14,4 +14,4 @@ fun foo() { // EXIST: { lookupString: "break@myDo", itemText: "break", tailText: "@myDo", attributes: "bold" } // EXIST: { lookupString: "break@myWhile", itemText: "break", tailText: "@myWhile", attributes: "bold" } // EXIST: { lookupString: "break@myFor", itemText: "break", tailText: "@myFor", attributes: "bold" } -// NUMBER: 3 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/CommaExpected.kt b/idea/idea-completion/testData/keywords/CommaExpected.kt index ad490b57e91..6cd7ae11eb9 100644 --- a/idea/idea-completion/testData/keywords/CommaExpected.kt +++ b/idea/idea-completion/testData/keywords/CommaExpected.kt @@ -7,4 +7,4 @@ fun foo() { // EXIST: as // EXIST: in // EXIST: is -// NUMBER: 5 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/ContinueWithLabel.kt b/idea/idea-completion/testData/keywords/ContinueWithLabel.kt index 4907f84514f..c508fb9433b 100644 --- a/idea/idea-completion/testData/keywords/ContinueWithLabel.kt +++ b/idea/idea-completion/testData/keywords/ContinueWithLabel.kt @@ -14,4 +14,4 @@ fun foo() { // EXIST: { lookupString: "continue@myDo", itemText: "continue", tailText: "@myDo", attributes: "bold" } // EXIST: { lookupString: "continue@myWhile", itemText: "continue", tailText: "@myWhile", attributes: "bold" } // EXIST: { lookupString: "continue@myFor", itemText: "continue", tailText: "@myFor", attributes: "bold" } -// NUMBER: 3 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/FileKeyword.kt b/idea/idea-completion/testData/keywords/FileKeyword.kt index d741a93d3ee..72056fe4728 100644 --- a/idea/idea-completion/testData/keywords/FileKeyword.kt +++ b/idea/idea-completion/testData/keywords/FileKeyword.kt @@ -1,4 +1,4 @@ [] // EXIST: file -// NUMBER: 1 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt index b93eced11c8..615a9bbc4ee 100644 --- a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt @@ -37,4 +37,6 @@ var a : Int // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 25 +// EXIST: companion +/*TODO*/ +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InArgumentList.kt b/idea/idea-completion/testData/keywords/InArgumentList.kt index 6a686b854f7..61a244f037c 100644 --- a/idea/idea-completion/testData/keywords/InArgumentList.kt +++ b/idea/idea-completion/testData/keywords/InArgumentList.kt @@ -20,4 +20,4 @@ fun foo(p: Int) { // EXIST: try // EXIST: when // EXIST: while -// NUMBER: 15 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt index 1256fc49ba6..3e5b5629b34 100644 --- a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt +++ b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt @@ -35,4 +35,5 @@ public class Test { // EXIST: constructor // EXIST: init /*why?*/ -// NUMBER: 24 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InClassScope.kt b/idea/idea-completion/testData/keywords/InClassScope.kt index dbeccfb9888..b116eb373d8 100644 --- a/idea/idea-completion/testData/keywords/InClassScope.kt +++ b/idea/idea-completion/testData/keywords/InClassScope.kt @@ -29,4 +29,5 @@ class TestClass { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 24 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InClassTypeParameters.kt b/idea/idea-completion/testData/keywords/InClassTypeParameters.kt index 872388e13a8..294458dedfe 100644 --- a/idea/idea-completion/testData/keywords/InClassTypeParameters.kt +++ b/idea/idea-completion/testData/keywords/InClassTypeParameters.kt @@ -2,4 +2,4 @@ class T<> // EXIST: in // EXIST: out -// NUMBER: 2 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InCodeBlock.kt b/idea/idea-completion/testData/keywords/InCodeBlock.kt index 11a85849c71..c046a46765d 100644 --- a/idea/idea-completion/testData/keywords/InCodeBlock.kt +++ b/idea/idea-completion/testData/keywords/InCodeBlock.kt @@ -21,4 +21,4 @@ fun foo() { // EXIST: var // EXIST: when // EXIST: while -// NUMBER: 19 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InConstructorParameterList.kt.todo b/idea/idea-completion/testData/keywords/InConstructorParameterList.kt.todo index 7dbe3e6bddf..f343ab33417 100644 --- a/idea/idea-completion/testData/keywords/InConstructorParameterList.kt.todo +++ b/idea/idea-completion/testData/keywords/InConstructorParameterList.kt.todo @@ -9,4 +9,4 @@ class C() // EXIST: protected // EXIST: internal // EXIST: override -// NUMBER: 8 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InFunctionExpressionBody.kt b/idea/idea-completion/testData/keywords/InFunctionExpressionBody.kt index b0938db2506..4f166f3aaeb 100644 --- a/idea/idea-completion/testData/keywords/InFunctionExpressionBody.kt +++ b/idea/idea-completion/testData/keywords/InFunctionExpressionBody.kt @@ -14,4 +14,4 @@ fun foo() = // EXIST: try // EXIST: when // EXIST: while -// NUMBER: 14 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InFunctionTypePosition.kt b/idea/idea-completion/testData/keywords/InFunctionTypePosition.kt index 2d8d0e2354a..c13740e7b92 100644 --- a/idea/idea-completion/testData/keywords/InFunctionTypePosition.kt +++ b/idea/idea-completion/testData/keywords/InFunctionTypePosition.kt @@ -5,4 +5,4 @@ fun foo() { /*TODO: Is 'package' type qualifier syntax correct?*/ // EXIST: package // EXIST: dynamic -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InGetterExpressionBody.kt b/idea/idea-completion/testData/keywords/InGetterExpressionBody.kt index d69baee529b..5531f12fd01 100644 --- a/idea/idea-completion/testData/keywords/InGetterExpressionBody.kt +++ b/idea/idea-completion/testData/keywords/InGetterExpressionBody.kt @@ -15,4 +15,4 @@ val prop: Int // EXIST: try // EXIST: when // EXIST: while -// NUMBER: 14 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InMemberFunParametersList.kt b/idea/idea-completion/testData/keywords/InMemberFunParametersList.kt index c1ea943f23f..0df6255778c 100644 --- a/idea/idea-completion/testData/keywords/InMemberFunParametersList.kt +++ b/idea/idea-completion/testData/keywords/InMemberFunParametersList.kt @@ -10,4 +10,4 @@ class TestSample() { // EXIST: var // EXIST: in // EXIST: out -// NUMBER: 4 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InModifierListInsideClass.kt b/idea/idea-completion/testData/keywords/InModifierListInsideClass.kt index 0cf5eadf31b..9017bf8bcf4 100644 --- a/idea/idea-completion/testData/keywords/InModifierListInsideClass.kt +++ b/idea/idea-completion/testData/keywords/InModifierListInsideClass.kt @@ -4,4 +4,4 @@ open class Foo { } // EXIST: private, public, protected -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InNotFinishedGenericWithFunAfter.kt b/idea/idea-completion/testData/keywords/InNotFinishedGenericWithFunAfter.kt index 23bb0532d4a..286ff311bf9 100644 --- a/idea/idea-completion/testData/keywords/InNotFinishedGenericWithFunAfter.kt +++ b/idea/idea-completion/testData/keywords/InNotFinishedGenericWithFunAfter.kt @@ -4,4 +4,4 @@ fun testing() {} // EXIST: in // EXIST: out -// NUMBER: 2 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InParameterDefaultValue.kt b/idea/idea-completion/testData/keywords/InParameterDefaultValue.kt index b1dca9d9aa3..e9e64210ba9 100644 --- a/idea/idea-completion/testData/keywords/InParameterDefaultValue.kt +++ b/idea/idea-completion/testData/keywords/InParameterDefaultValue.kt @@ -15,4 +15,4 @@ fun foo(p: Int = ) // EXIST: try // EXIST: when // EXIST: while -// NUMBER: 15 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InPropertyInitializer.kt b/idea/idea-completion/testData/keywords/InPropertyInitializer.kt index 82ccb0125d3..34bb5acf940 100644 --- a/idea/idea-completion/testData/keywords/InPropertyInitializer.kt +++ b/idea/idea-completion/testData/keywords/InPropertyInitializer.kt @@ -14,4 +14,4 @@ var a : Int = // EXIST: try // EXIST: when // EXIST: while -// NUMBER: 14 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InTopFunParametersList.kt b/idea/idea-completion/testData/keywords/InTopFunParametersList.kt index c08fc81ba6c..4e76845a5e8 100644 --- a/idea/idea-completion/testData/keywords/InTopFunParametersList.kt +++ b/idea/idea-completion/testData/keywords/InTopFunParametersList.kt @@ -7,4 +7,4 @@ fun test() { // EXIST: var // EXIST: in // EXIST: out -// NUMBER: 4 \ No newline at end of file +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt index ddddb47234d..83b926187d3 100644 --- a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt +++ b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt @@ -28,4 +28,6 @@ package Test // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 23 +// EXIST: companion +/*TODO*/ +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/PrefixMatcher.kt b/idea/idea-completion/testData/keywords/PrefixMatcher.kt index c22839fdd3a..9e3470642af 100644 --- a/idea/idea-completion/testData/keywords/PrefixMatcher.kt +++ b/idea/idea-completion/testData/keywords/PrefixMatcher.kt @@ -6,4 +6,4 @@ p // EXIST: private // EXIST: protected // EXIST: public -// NUMBER: 4 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors.kt b/idea/idea-completion/testData/keywords/PropertyAccessors.kt index 13b6ea01dca..b5a802bb8f4 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors.kt @@ -33,4 +33,5 @@ class Some { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 27 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt index 6fa56ddfc84..3705a84980f 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt @@ -33,4 +33,5 @@ class Some { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 27 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/PropertySetter.kt b/idea/idea-completion/testData/keywords/PropertySetter.kt index 31e9f05e465..b43162d7f16 100644 --- a/idea/idea-completion/testData/keywords/PropertySetter.kt +++ b/idea/idea-completion/testData/keywords/PropertySetter.kt @@ -35,4 +35,5 @@ class Some { /*why?*/ // EXIST: constructor // EXIST: init -// NUMBER: 27 +// EXIST: companion +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/QualifiedThis.kt b/idea/idea-completion/testData/keywords/QualifiedThis.kt index be537ff2870..bf94c3d607f 100644 --- a/idea/idea-completion/testData/keywords/QualifiedThis.kt +++ b/idea/idea-completion/testData/keywords/QualifiedThis.kt @@ -10,4 +10,4 @@ class Outer { // EXIST: { lookupString: "this@foo", itemText: "this", tailText: "@foo", typeText: "String", attributes: "bold" } // EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Inner", attributes: "bold" } // EXIST: { lookupString: "this@Outer", itemText: "this", tailText: "@Outer", typeText: "Outer", attributes: "bold" } -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/QualifiedThisInAccessor.kt b/idea/idea-completion/testData/keywords/QualifiedThisInAccessor.kt index 21c4dca6d4b..2d17f12f9d7 100644 --- a/idea/idea-completion/testData/keywords/QualifiedThisInAccessor.kt +++ b/idea/idea-completion/testData/keywords/QualifiedThisInAccessor.kt @@ -2,4 +2,4 @@ val String.foo: Int get() = this@.length() // EXIST: "this@foo" -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/Return1.kt b/idea/idea-completion/testData/keywords/Return1.kt index 9a839c6cf3f..ab10bf80a21 100644 --- a/idea/idea-completion/testData/keywords/Return1.kt +++ b/idea/idea-completion/testData/keywords/Return1.kt @@ -11,4 +11,4 @@ inline fun takeHandler2(handler: () -> Unit){} // EXIST: { lookupString: "return", itemText: "return", tailText: null, attributes: "bold" } // EXIST: { lookupString: "return@takeHandler1", itemText: "return", tailText: "@takeHandler1", attributes: "bold" } // EXIST: { lookupString: "return@takeHandler2", itemText: "return", tailText: "@takeHandler2", attributes: "bold" } -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/Return6.kt b/idea/idea-completion/testData/keywords/Return6.kt index 3e74d62b632..94171c2674a 100644 --- a/idea/idea-completion/testData/keywords/Return6.kt +++ b/idea/idea-completion/testData/keywords/Return6.kt @@ -10,4 +10,4 @@ inline fun takeHandler2(handler: () -> Unit){} // INVOCATION_COUNT: 1 // EXIST: { lookupString: "return@takeHandler1", itemText: "return", tailText: "@takeHandler1", attributes: "bold" } // EXIST: { lookupString: "return@takeHandler2", itemText: "return", tailText: "@takeHandler2", attributes: "bold" } -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/This.kt b/idea/idea-completion/testData/keywords/This.kt index dc49e9b310e..a9a9a228a17 100644 --- a/idea/idea-completion/testData/keywords/This.kt +++ b/idea/idea-completion/testData/keywords/This.kt @@ -25,4 +25,4 @@ fun takeHandler3(handler: Char.() -> Unit){} // EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Nested.Inner", attributes: "bold" } // EXIST: { lookupString: "this@Nested", itemText: "this", tailText: "@Nested", typeText: "Outer.Nested", attributes: "bold" } // ABSENT: "this@Outer" -// NUMBER: 6 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/keywords/TopScope.kt b/idea/idea-completion/testData/keywords/TopScope.kt index c13169196d0..de70cd067ba 100644 --- a/idea/idea-completion/testData/keywords/TopScope.kt +++ b/idea/idea-completion/testData/keywords/TopScope.kt @@ -27,4 +27,6 @@ // EXIST: var // EXIST: vararg /*why?*/ -// NUMBER: 24 +// EXIST: companion +/*TODO*/ +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/AfterEmptyArgument.kt b/idea/idea-completion/testData/smart/AfterEmptyArgument.kt index c2cc89cb9e3..6c57f9387ab 100644 --- a/idea/idea-completion/testData/smart/AfterEmptyArgument.kt +++ b/idea/idea-completion/testData/smart/AfterEmptyArgument.kt @@ -7,4 +7,4 @@ fun bar(pInt: Int, pString: String) { // EXIST: { lookupString: "param1", itemText: "param1 =" } // EXIST: { lookupString: "param3", itemText: "param3 =" } // ABSENT: param2 -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/AfterNamedArgument.kt b/idea/idea-completion/testData/smart/AfterNamedArgument.kt index ddb346edfe0..02468b7881f 100644 --- a/idea/idea-completion/testData/smart/AfterNamedArgument.kt +++ b/idea/idea-completion/testData/smart/AfterNamedArgument.kt @@ -7,4 +7,4 @@ fun bar(pInt: Int, pString: String) { // EXIST: { lookupString: "param1", itemText: "param1 =" } // EXIST: { lookupString: "param3", itemText: "param3 =" } // ABSENT: param2 -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/GroupBySubstitutor.kt b/idea/idea-completion/testData/smart/GroupBySubstitutor.kt index 1d47887b1b8..6bf8318fd1b 100644 --- a/idea/idea-completion/testData/smart/GroupBySubstitutor.kt +++ b/idea/idea-completion/testData/smart/GroupBySubstitutor.kt @@ -9,4 +9,4 @@ fun f(){ // EXIST: { lookupString: "emptyList", typeText: "List" } // EXIST: { lookupString: "emptyList", typeText: "List" } -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/Object.kt b/idea/idea-completion/testData/smart/Object.kt index 69c72141341..2242a9a16ab 100644 --- a/idea/idea-completion/testData/smart/Object.kt +++ b/idea/idea-completion/testData/smart/Object.kt @@ -7,4 +7,4 @@ fun foo(): I = // EXIST: { lookupString: "O", itemText: "O", tailText: " ()" } // EXIST: foo // EXIST: object -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/ObjectsFromType.kt b/idea/idea-completion/testData/smart/ObjectsFromType.kt index e34bb98041e..e02b87b1101 100644 --- a/idea/idea-completion/testData/smart/ObjectsFromType.kt +++ b/idea/idea-completion/testData/smart/ObjectsFromType.kt @@ -14,4 +14,4 @@ fun foo(): T { // EXIST: foo // EXIST: object // ABSENT: Other -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/afterAs/1.kt b/idea/idea-completion/testData/smart/afterAs/1.kt index 684e30a721a..734fffe50d0 100644 --- a/idea/idea-completion/testData/smart/afterAs/1.kt +++ b/idea/idea-completion/testData/smart/afterAs/1.kt @@ -6,6 +6,6 @@ fun bar(o: Any) { foo(o as ) } -// NUMBER: 2 // EXIST: String // EXIST: Int +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/afterAs/2.kt b/idea/idea-completion/testData/smart/afterAs/2.kt index a8364373756..67208d39553 100644 --- a/idea/idea-completion/testData/smart/afterAs/2.kt +++ b/idea/idea-completion/testData/smart/afterAs/2.kt @@ -6,6 +6,6 @@ fun bar(o: Any) { foo(o as ) } -// NUMBER: 2 // EXIST: { lookupString:"List", itemText:"List" } // EXIST: { lookupString:"Map", itemText:"Map" } +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/afterAs/3.kt b/idea/idea-completion/testData/smart/afterAs/3.kt index d4b41a67aff..c1515c789ec 100644 --- a/idea/idea-completion/testData/smart/afterAs/3.kt +++ b/idea/idea-completion/testData/smart/afterAs/3.kt @@ -7,6 +7,6 @@ fun bar(o: Any) { foo(o as ) } -// NUMBER: 2 // EXIST: { lookupString:"List", itemText:"List" } // EXIST: { lookupString:"String", itemText:"String" } +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/constructor/InnerClass.kt b/idea/idea-completion/testData/smart/constructor/InnerClass.kt index 9edbe320d9a..014a1b740f3 100644 --- a/idea/idea-completion/testData/smart/constructor/InnerClass.kt +++ b/idea/idea-completion/testData/smart/constructor/InnerClass.kt @@ -15,4 +15,4 @@ fun foo(c: C): T { // EXIST: { lookupString: "Inner2", itemText: "Inner2", tailText: "()", typeText: "C.Inner2" } // ABSENT: Inner3 // ABSENT: Nested -// NUMBER: 2 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/constructor/NoInnerClassInstantiation.kt b/idea/idea-completion/testData/smart/constructor/NoInnerClassInstantiation.kt index 8516fdbf8f0..09c7611032d 100644 --- a/idea/idea-completion/testData/smart/constructor/NoInnerClassInstantiation.kt +++ b/idea/idea-completion/testData/smart/constructor/NoInnerClassInstantiation.kt @@ -8,4 +8,4 @@ fun foo() : C.Inner { // ABSENT: Inner // EXIST: foo -// NUMBER: 1 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smart/this/QualifiedThis.kt b/idea/idea-completion/testData/smart/this/QualifiedThis.kt index 5283b4c901a..904d7f9d491 100644 --- a/idea/idea-completion/testData/smart/this/QualifiedThis.kt +++ b/idea/idea-completion/testData/smart/this/QualifiedThis.kt @@ -10,4 +10,4 @@ class Outer { // EXIST: { lookupString: "this@foo", itemText: "this", tailText: "@foo", typeText: "String", attributes: "bold" } // EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Inner", attributes: "bold" } // EXIST: { lookupString: "this@Outer", itemText: "this", tailText: "@Outer", typeText: "Outer", attributes: "bold" } -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smartMultiFile/InheritorsAndMultipleExpectedTypes/InheritorsAndMultipleExpectedTypes.kt b/idea/idea-completion/testData/smartMultiFile/InheritorsAndMultipleExpectedTypes/InheritorsAndMultipleExpectedTypes.kt index 96d44066f11..fec8440647b 100644 --- a/idea/idea-completion/testData/smartMultiFile/InheritorsAndMultipleExpectedTypes/InheritorsAndMultipleExpectedTypes.kt +++ b/idea/idea-completion/testData/smartMultiFile/InheritorsAndMultipleExpectedTypes/InheritorsAndMultipleExpectedTypes.kt @@ -9,4 +9,4 @@ fun bar() { // EXIST: { lookupString: "C2", itemText: "C2" } // EXIST: { lookupString: "C2", itemText: "C2" } // EXIST: { lookupString: "C3", itemText: "C3" } -// NUMBER: 7 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/testData/smartMultiFile/NoObjectDuplication/NoObjectDuplication.kt b/idea/idea-completion/testData/smartMultiFile/NoObjectDuplication/NoObjectDuplication.kt index 82c1077b2ec..6aedde155c3 100644 --- a/idea/idea-completion/testData/smartMultiFile/NoObjectDuplication/NoObjectDuplication.kt +++ b/idea/idea-completion/testData/smartMultiFile/NoObjectDuplication/NoObjectDuplication.kt @@ -3,4 +3,4 @@ fun foo(): T = // EXIST: foo // EXIST: { lookupString: "object", itemText: "object: T{...}" } // EXIST: { lookupString: "OO", itemText: "OO", tailText: " ()" } -// NUMBER: 3 +// NOTHING_ELSE: true diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt index 9547b26e528..ea914768d24 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt @@ -26,9 +26,8 @@ public abstract class AbstractKeywordCompletionTest : JetFixtureCompletionBaseTe override fun getPlatform() = TargetPlatform.JVM override fun complete(invocationCount: Int): Array? { - val items = myFixture.complete(CompletionType.BASIC) - if (items == null) return null - return items.filter { it.getObject() is KeywordLookupObject }.copyToArray() + val items = myFixture.complete(CompletionType.BASIC) ?: return null + return items.filter { it.getObject() is KeywordLookupObject }.toTypedArray() } override fun getProjectDescriptor() = JetLightProjectDescriptor.INSTANCE diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestUtil.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestUtil.kt index b955aa571b4..edeab3304ca 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestUtil.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestUtil.kt @@ -28,21 +28,22 @@ val COMPLETION_TEST_DATA_BASE_PATH: String fun testCompletion(fileText: String, platform: TargetPlatform?, complete: (Int) -> Array?, defaultInvocationCount: Int = 0) { testWithAutoCompleteSetting(fileText) { val invocationCount = ExpectedCompletionUtils.getInvocationCount(fileText) ?: defaultInvocationCount - val items = complete(invocationCount) ?: array() + val items = complete(invocationCount) ?: emptyArray() ExpectedCompletionUtils.assertDirectivesValid(fileText) val expected = ExpectedCompletionUtils.itemsShouldExist(fileText, platform) val unexpected = ExpectedCompletionUtils.itemsShouldAbsent(fileText, platform) val itemsNumber = ExpectedCompletionUtils.getExpectedNumber(fileText, platform) + val nothingElse = ExpectedCompletionUtils.isNothingElseExpected(fileText) - Assert.assertTrue("Should be some assertions about completion", expected.size != 0 || unexpected.size != 0 || itemsNumber != null) - ExpectedCompletionUtils.assertContainsRenderedItems(expected, items, ExpectedCompletionUtils.isWithOrder(fileText)) + Assert.assertTrue("Should be some assertions about completion", expected.size() != 0 || unexpected.size() != 0 || itemsNumber != null || nothingElse) + ExpectedCompletionUtils.assertContainsRenderedItems(expected, items, ExpectedCompletionUtils.isWithOrder(fileText), nothingElse) ExpectedCompletionUtils.assertNotContainsRenderedItems(unexpected, items) if (itemsNumber != null) { val expectedItems = ExpectedCompletionUtils.listToString(ExpectedCompletionUtils.getItemsInformation(items)) - Assert.assertEquals("Invalid number of completion items: ${expectedItems}", itemsNumber, items.size) + Assert.assertEquals("Invalid number of completion items: ${expectedItems}", itemsNumber, items.size()) } } } diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.java index 745dcd0a743..fef22c3346b 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.java @@ -123,6 +123,8 @@ public class ExpectedCompletionUtils { private static final String NUMBER_JS_LINE_PREFIX = "NUMBER_JS:"; private static final String NUMBER_JAVA_LINE_PREFIX = "NUMBER_JAVA:"; + private static final String NOTHING_ELSE_PREFIX = "NOTHING_ELSE:"; + private static final String INVOCATION_COUNT_PREFIX = "INVOCATION_COUNT:"; private static final String WITH_ORDER_PREFIX = "WITH_ORDER:"; private static final String AUTOCOMPLETE_SETTING_PREFIX = "AUTOCOMPLETE_SETTING:"; @@ -142,6 +144,7 @@ public class ExpectedCompletionUtils { INVOCATION_COUNT_PREFIX, WITH_ORDER_PREFIX, AUTOCOMPLETE_SETTING_PREFIX, + NOTHING_ELSE_PREFIX, RUNTIME_TYPE, AstAccessControl.INSTANCE$.getALLOW_AST_ACCESS_DIRECTIVE()); @@ -214,6 +217,10 @@ public class ExpectedCompletionUtils { } } + public static boolean isNothingElseExpected(String fileText) { + return Boolean.TRUE.equals(InTextDirectivesUtils.getPrefixedBoolean(fileText, NOTHING_ELSE_PREFIX)); + } + @Nullable public static Integer getInvocationCount(String fileText) { return InTextDirectivesUtils.getPrefixedInt(fileText, INVOCATION_COUNT_PREFIX); @@ -232,10 +239,12 @@ public class ExpectedCompletionUtils { InTextDirectivesUtils.assertHasUnknownPrefixes(fileText, KNOWN_PREFIXES); } - public static void assertContainsRenderedItems(CompletionProposal[] expected, LookupElement[] items, boolean checkOrder) { + public static void assertContainsRenderedItems(CompletionProposal[] expected, LookupElement[] items, boolean checkOrder, boolean nothingElse) { List itemsInformation = getItemsInformation(items); String allItemsString = listToString(itemsInformation); + Set leftItems = nothingElse ? new LinkedHashSet(itemsInformation) : null; + int indexOfPrevious = Integer.MIN_VALUE; for (CompletionProposal expectedProposal : expected) { @@ -251,6 +260,10 @@ public class ExpectedCompletionUtils { !checkOrder || index > indexOfPrevious); indexOfPrevious = index; + if (leftItems != null) { + leftItems.remove(proposal); + } + break; } } @@ -264,6 +277,10 @@ public class ExpectedCompletionUtils { } } } + + if (leftItems != null && !leftItems.isEmpty()) { + Assert.fail("No items not mentioned in EXIST directives expected but some found:\n" + listToString(leftItems)); + } } private static Integer getPlatformExpectedNumber(String fileText, String platformNumberPrefix) {