mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract groovy smart completion test; move all groovy completion test to a dedicated package
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy
|
||||
package org.jetbrains.plugins.groovy.completion
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.roots.ContentEntry
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy;
|
||||
package org.jetbrains.plugins.groovy.completion;
|
||||
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings
|
||||
+3
-72
@@ -14,15 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.groovy;
|
||||
package org.jetbrains.plugins.groovy.completion;
|
||||
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType
|
||||
|
||||
/**
|
||||
* @author Maxim.Medvedev
|
||||
*/
|
||||
@@ -38,38 +39,6 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
myFixture.checkResultByFile(getTestName(false) + "_after.groovy");
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclaration() throws Throwable {
|
||||
myFixture.configureByFile(getTestName(false) + ".groovy");
|
||||
myFixture.complete(CompletionType.SMART);
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "Bar", "Foo");
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithInterface() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testCaretAfterSmartCompletionAfterNewInDeclaration() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithAbstractClass() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithArray() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithIntArray() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testShortenNamesInSmartCompletionAfterNewInDeclaration() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testSmartAfterNewInCall() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testNamedParametersForApplication() throws Throwable {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
@@ -151,11 +120,6 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "Inner1", "Inner2");
|
||||
}
|
||||
|
||||
public void testInnerClassInStaticMethodCompletion() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
|
||||
public void testQualifiedThisCompletion() throws Throwable {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "foo1", "foo2");
|
||||
}
|
||||
@@ -208,42 +172,9 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "geteMail", "getePost");
|
||||
}
|
||||
|
||||
public void testSmartCompletionInAssignmentExpression() throws Throwable {
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testSimpleMethodParameter() throws Throwable {
|
||||
doSmartCompletion("d1", "d2");
|
||||
}
|
||||
|
||||
public void testReturnStatement() throws Exception {
|
||||
doSmartCompletion("b", "b1", "b2", "foo");
|
||||
}
|
||||
|
||||
public void testIncSmartCompletion() throws Exception {
|
||||
doSmartCompletion("a", "b");
|
||||
}
|
||||
|
||||
public void testInheritConstructorsAnnotation() throws Throwable {
|
||||
myFixture.addFileToProject("groovy/transform/InheritConstructors.java", "package groovy.transform;\n" +
|
||||
"\n" +
|
||||
"import java.lang.annotation.ElementType;\n" +
|
||||
"import java.lang.annotation.Retention;\n" +
|
||||
"import java.lang.annotation.RetentionPolicy;\n" +
|
||||
"import java.lang.annotation.Target;@Retention(RetentionPolicy.SOURCE)\n" +
|
||||
"@Target({ElementType.TYPE})\n" +
|
||||
"public @interface InheritConstructors {\n" +
|
||||
"}");
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testIntCompletionInPlusMethod() {doBasicTest();}
|
||||
public void testIntCompletionInGenericParameter() {doBasicTest();}
|
||||
|
||||
public void testSmartCastCompletion() {doSmartTest();}
|
||||
public void testSmartCastCompletionWithoutRParenth() {doSmartTest();}
|
||||
public void testSmartCastCompletionWithRParenth() {doSmartTest();}
|
||||
|
||||
public void testWhenSiblingIsStaticallyImported_Method() throws Exception {
|
||||
myFixture.addFileToProject "foo/Foo.groovy", """package foo
|
||||
class Foo {
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy;
|
||||
package org.jetbrains.plugins.groovy.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.groovy.completion;
|
||||
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class GroovySmartCompletionTest extends GroovyCompletionTestBase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "groovy/completion/smart";
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclaration() throws Throwable {
|
||||
myFixture.configureByFile(getTestName(false) + ".groovy");
|
||||
myFixture.complete(CompletionType.SMART);
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "Bar", "Foo");
|
||||
}
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithInterface() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testCaretAfterSmartCompletionAfterNewInDeclaration() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithAbstractClass() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithArray() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testSmartCompletionAfterNewInDeclarationWithIntArray() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testShortenNamesInSmartCompletionAfterNewInDeclaration() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testSmartAfterNewInCall() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testInnerClassInStaticMethodCompletion() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testSmartCompletionInAssignmentExpression() throws Throwable { doSmartTest(); }
|
||||
|
||||
public void testSimpleMethodParameter() throws Throwable {
|
||||
doSmartCompletion("d1", "d2");
|
||||
}
|
||||
|
||||
public void testReturnStatement() throws Exception {
|
||||
doSmartCompletion("b", "b1", "b2", "foo");
|
||||
}
|
||||
|
||||
public void testIncSmartCompletion() throws Exception {
|
||||
doSmartCompletion("a", "b");
|
||||
}
|
||||
|
||||
public void testInheritConstructorsAnnotation() throws Throwable {
|
||||
myFixture.addFileToProject("groovy/transform/InheritConstructors.java", "package groovy.transform;\n" +
|
||||
"\n" +
|
||||
"import java.lang.annotation.ElementType;\n" +
|
||||
"import java.lang.annotation.Retention;\n" +
|
||||
"import java.lang.annotation.RetentionPolicy;\n" +
|
||||
"import java.lang.annotation.Target;@Retention(RetentionPolicy.SOURCE)\n" +
|
||||
"@Target({ElementType.TYPE})\n" +
|
||||
"public @interface InheritConstructors {\n" +
|
||||
"}");
|
||||
doSmartTest();
|
||||
}
|
||||
|
||||
public void testSmartCastCompletion() {doSmartTest();}
|
||||
public void testSmartCastCompletionWithoutRParenth() {doSmartTest();}
|
||||
public void testSmartCastCompletionWithRParenth() {doSmartTest();}
|
||||
|
||||
def getFileText(PsiFile file) {
|
||||
return PsiDocumentManager.getInstance(project).getDocument(file).text
|
||||
}
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
class A{
|
||||
class Inner {
|
||||
|
||||
}
|
||||
|
||||
static def foo() {
|
||||
Inner i=new <caret>
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user