Refactor tests and activate them for working with JS
This commit is contained in:
@@ -27,6 +27,8 @@ import org.jetbrains.jet.codegen.AbstractTopLevelMembersInvocationTest;
|
||||
import org.jetbrains.jet.codegen.defaultConstructor.AbstractDefaultConstructorCodegenTest;
|
||||
import org.jetbrains.jet.codegen.flags.AbstractWriteFlagsTest;
|
||||
import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
||||
import org.jetbrains.jet.completion.AbstractJavaCompletionTest;
|
||||
import org.jetbrains.jet.completion.AbstractJetJSCompletionTest;
|
||||
import org.jetbrains.jet.jvm.compiler.*;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveDescriptorRendererTest;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparingTest;
|
||||
@@ -223,6 +225,22 @@ public class GenerateTests {
|
||||
new SimpleTestClassModel(new File("idea/testData/quickfix"), true, Pattern.compile("^before(\\w+)\\.kt$"), "doTest")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"idea/tests/",
|
||||
"JetBasicJSCompletionTest",
|
||||
AbstractJetJSCompletionTest.class,
|
||||
testModel("idea/testData/completion/basic", false, "doTest"),
|
||||
testModel("idea/testData/completion/basic/js", false, "doTest")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"idea/tests/",
|
||||
"JetBasicJavaCompletionTest",
|
||||
AbstractJavaCompletionTest.class,
|
||||
testModel("idea/testData/completion/basic", false, "doTest"),
|
||||
testModel("idea/testData/completion/basic/java", false, "doTest")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"idea/tests/",
|
||||
"QuickFixMultiFileTestGenerated",
|
||||
@@ -286,6 +304,10 @@ public class GenerateTests {
|
||||
return testModel(rootPath, true, "kt", methodName);
|
||||
}
|
||||
|
||||
private static SimpleTestClassModel testModel(@NotNull String rootPath, boolean recursive, @NotNull String methodName) {
|
||||
return testModel(rootPath, recursive, "kt", methodName);
|
||||
}
|
||||
|
||||
private static SimpleTestClassModel testModelWithDirectories(@NotNull String rootPath, @NotNull String methodName) {
|
||||
return new SimpleTestClassModel(new File(rootPath), false, Pattern.compile("^(.+)$"), methodName);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// KT-1187 Wrong unnecessary completion
|
||||
/// KT-1187 Wrong unnecessary completion
|
||||
|
||||
fun anyfun() {
|
||||
a.b.c.d.e.f.<caret>
|
||||
|
||||
@@ -4,4 +4,5 @@ class Test {
|
||||
|
||||
// TIME: 1
|
||||
// EXIST: String~(jet)
|
||||
// EXIST: StringBuffer
|
||||
// EXIST: StringBuilder
|
||||
// EXIST_JAVA_ONLY: StringBuffer
|
||||
|
||||
@@ -5,7 +5,7 @@ fun S<caret>
|
||||
// Should complete types for receiver after explicit basic completion call
|
||||
// TIME: 1
|
||||
// EXIST: String
|
||||
// EXIST: StringBuffer
|
||||
// EXIST_JAVA_ONLY: StringBuffer
|
||||
// EXIST: Set
|
||||
// ABSENT: testing
|
||||
|
||||
|
||||
@@ -6,4 +6,6 @@ fun hello() {
|
||||
val a = So<caret>
|
||||
}
|
||||
|
||||
// EXIST: SortedSet, SortedMap
|
||||
// EXIST: SortedSet
|
||||
// EXIST_JAVA_ONLY: SortedMap
|
||||
// EXIST_JS_ONLY: JSON
|
||||
|
||||
@@ -2,5 +2,7 @@ package Test
|
||||
|
||||
import <caret>
|
||||
|
||||
// EXIST: java, javax
|
||||
// EXIST: java,
|
||||
// EXIST_JAVA_ONLY: javax
|
||||
// EXIST_JS_ONLY: js
|
||||
// ABSENT: Array, Integer
|
||||
@@ -6,4 +6,5 @@ class Test {
|
||||
|
||||
}
|
||||
|
||||
// EXIST: AbstractList, Date, Random, concurrent
|
||||
// EXIST: AbstractList, Date
|
||||
// EXIST_JAVA_ONLY: Random, concurrent
|
||||
@@ -4,5 +4,5 @@ fun test() {
|
||||
val a : Named<caret>
|
||||
}
|
||||
|
||||
// TIMES: 2
|
||||
// TIME: 2
|
||||
// ABSENT: NamedObject
|
||||
|
||||
@@ -4,7 +4,6 @@ fun firstFun() {
|
||||
val a = In<caret>
|
||||
}
|
||||
|
||||
// RUNTIME: 1
|
||||
// TIME: 0
|
||||
// EXIST: Int~(jet)
|
||||
// ABSENT: Int~(jet.runtime.SharedVar)
|
||||
@@ -0,0 +1,10 @@
|
||||
package testing
|
||||
|
||||
class Hello() {
|
||||
fun test() {
|
||||
val a : S<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: Set, Short, ShortArray
|
||||
// ABSENT: toString
|
||||
@@ -2,11 +2,12 @@ fun main(args: Array<String>) {
|
||||
Array<caret>
|
||||
}
|
||||
|
||||
// COMPLETE: 2
|
||||
// TIME: 2
|
||||
// WITH_ORDER: 1
|
||||
// EXIST: Array~(jet)
|
||||
// EXIST: Array~(java.sql)
|
||||
|
||||
// EXIST_JAVA_ONLY: Array~(java.sql)
|
||||
// EXIST_JAVA_ONLY: ArrayList~<E> (java.util)
|
||||
// EXIST_JS_ONLY: ArrayList~(java.util)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
fun some(a: Double<caret>) {
|
||||
}
|
||||
|
||||
// COMPLETE: 2
|
||||
// TIME: 2
|
||||
// WITH_ORDER: 1
|
||||
// EXIST: Double~(jet)
|
||||
// EXIST: Double~(java.lang)
|
||||
// EXIST_JAVA_ONLY: Double~(java.lang)
|
||||
// EXIST: DoubleArray~(jet)
|
||||
|
||||
-1
@@ -7,7 +7,6 @@ fun firstFun() {
|
||||
a.toLinke<caret>
|
||||
}
|
||||
|
||||
// RUNTIME: 1
|
||||
// TIME: 1
|
||||
// EXIST: toLinkedList@toLinkedList()~for jet.Iterable<T> in kotlin
|
||||
// NUMBER: 1
|
||||
+3
-1
@@ -7,4 +7,6 @@ class Hello() {
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: SortedMap, Short, Socket
|
||||
// TIME: 2
|
||||
// EXIST: SortedMap, Short, Socket
|
||||
// ABSENT: hashSetOf
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
val x = LineIterator<caret>
|
||||
|
||||
// RUNTIME: 1
|
||||
// TIME: 1
|
||||
// EXIST: LineIterator
|
||||
// EXIST: LineIterator~(kotlin.io)
|
||||
// NUMBER: 1
|
||||
+1
-1
@@ -3,5 +3,5 @@ import java.io.InputStreamReader
|
||||
val x = InputStreamReader<caret>
|
||||
|
||||
// TIME: 1
|
||||
// EXIST: InputStreamReader
|
||||
// EXIST: InputStreamReader~(java.io)
|
||||
// NUMBER: 1
|
||||
-1
@@ -7,5 +7,4 @@ fun someFun() {
|
||||
// Important: This test checks that completion will find top level functions from jars.
|
||||
// If you going to update it make sure that methods are not auto-imported
|
||||
|
||||
// RUNTIME: 1
|
||||
// EXIST: measureTimeNano, measureTimeMillis
|
||||
-1
@@ -7,5 +7,4 @@ fun someFun() {
|
||||
// Important: This test checks that completion will find top level functions from jars.
|
||||
// If you going to update it make sure that methods are not auto-imported
|
||||
|
||||
// RUNTIME: 1
|
||||
// EXIST: defaultDocumentBuilderFactory
|
||||
@@ -0,0 +1,4 @@
|
||||
package js.<caret>
|
||||
|
||||
// EXIST: dom
|
||||
// ABSENT: Date, JSON, capitalize
|
||||
@@ -0,0 +1,4 @@
|
||||
val test = JSON.<caret>
|
||||
|
||||
// EXIST: stringify
|
||||
// EXIST: parse
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.completion;
|
||||
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor;
|
||||
|
||||
public abstract class AbstractJavaCompletionTest extends JetFixtureCompletionBaseTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpectedCompletionUtils.Platform getPlatform() {
|
||||
return ExpectedCompletionUtils.Platform.JAVA;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.completion;
|
||||
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetStdJSProjectDescriptor;
|
||||
|
||||
public abstract class AbstractJetJSCompletionTest extends JetFixtureCompletionBaseTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JetStdJSProjectDescriptor.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpectedCompletionUtils.Platform getPlatform() {
|
||||
return ExpectedCompletionUtils.Platform.JS;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.completion;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -97,30 +98,44 @@ public class ExpectedCompletionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static final String EXIST_LINE_PREFIX = "// EXIST:";
|
||||
public static final String EXIST_JS_LINE_PREFIX = "// EXIST_JS:";
|
||||
public static final String EXIST_JAVA_LINE_PREFIX = "// EXIST_JAVA:";
|
||||
private static final String EXIST_LINE_PREFIX = "EXIST:";
|
||||
|
||||
public static final String ABSENT_LINE_PREFIX = "// ABSENT:";
|
||||
public static final String ABSENT_JS_LINE_PREFIX = "// ABSENT_JS:";
|
||||
public static final String ABSENT_JAVA_LINE_PREFIX = "// ABSENT_JAVA:";
|
||||
private static final String ABSENT_LINE_PREFIX = "ABSENT:";
|
||||
private static final String ABSENT_JS_LINE_PREFIX = "ABSENT_JS:";
|
||||
private static final String ABSENT_JAVA_LINE_PREFIX = "ABSENT_JAVA:";
|
||||
|
||||
public static final String NUMBER_LINE_PREFIX = "// NUMBER:";
|
||||
public static final String NUMBER_JS_LINE_PREFIX = "// NUMBER_JS:";
|
||||
public static final String NUMBER_JAVA_LINE_PREFIX = "// NUMBER_JAVA:";
|
||||
private static final String EXIST_JAVA_ONLY_LINE_PREFIX = "EXIST_JAVA_ONLY:";
|
||||
private static final String EXIST_JS_ONLY_LINE_PREFIX = "EXIST_JS_ONLY:";
|
||||
|
||||
public static final String EXECUTION_TIME_PREFIX = "// TIME:";
|
||||
public static final String WITH_ORDER_PREFIX = "// WITH_ORDER:";
|
||||
private static final String NUMBER_LINE_PREFIX = "NUMBER:";
|
||||
private static final String NUMBER_JS_LINE_PREFIX = "NUMBER_JS:";
|
||||
private static final String NUMBER_JAVA_LINE_PREFIX = "NUMBER_JAVA:";
|
||||
|
||||
private static final String EXECUTION_TIME_PREFIX = "TIME:";
|
||||
private static final String WITH_ORDER_PREFIX = "WITH_ORDER:";
|
||||
|
||||
public static final List<String> KNOWN_PREFIXES = ImmutableList.of(
|
||||
EXIST_LINE_PREFIX,
|
||||
ABSENT_LINE_PREFIX,
|
||||
ABSENT_JS_LINE_PREFIX,
|
||||
ABSENT_JAVA_LINE_PREFIX,
|
||||
EXIST_JAVA_ONLY_LINE_PREFIX,
|
||||
EXIST_JS_ONLY_LINE_PREFIX,
|
||||
NUMBER_LINE_PREFIX,
|
||||
NUMBER_JS_LINE_PREFIX,
|
||||
NUMBER_JAVA_LINE_PREFIX,
|
||||
EXECUTION_TIME_PREFIX,
|
||||
WITH_ORDER_PREFIX);
|
||||
|
||||
@NotNull
|
||||
public static CompletionProposal[] itemsShouldExist(String fileText, Platform platform) {
|
||||
switch (platform) {
|
||||
case ALL:
|
||||
return processProposalAssertions(fileText, EXIST_LINE_PREFIX, EXIST_JAVA_LINE_PREFIX, EXIST_JS_LINE_PREFIX);
|
||||
return processProposalAssertions(fileText, EXIST_LINE_PREFIX);
|
||||
case JAVA:
|
||||
return processProposalAssertions(fileText, EXIST_LINE_PREFIX, EXIST_JAVA_LINE_PREFIX);
|
||||
return processProposalAssertions(fileText, EXIST_LINE_PREFIX, EXIST_JAVA_ONLY_LINE_PREFIX);
|
||||
case JS:
|
||||
return processProposalAssertions(fileText, EXIST_LINE_PREFIX, EXIST_JS_LINE_PREFIX);
|
||||
return processProposalAssertions(fileText, EXIST_LINE_PREFIX, EXIST_JS_ONLY_LINE_PREFIX);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("platform");
|
||||
@@ -130,11 +145,11 @@ public class ExpectedCompletionUtils {
|
||||
public static CompletionProposal[] itemsShouldAbsent(String fileText, Platform platform) {
|
||||
switch (platform) {
|
||||
case ALL:
|
||||
return processProposalAssertions(fileText, ABSENT_LINE_PREFIX, EXIST_JAVA_LINE_PREFIX, EXIST_JS_LINE_PREFIX);
|
||||
return processProposalAssertions(fileText, ABSENT_LINE_PREFIX);
|
||||
case JAVA:
|
||||
return processProposalAssertions(fileText, ABSENT_LINE_PREFIX, ABSENT_JAVA_LINE_PREFIX);
|
||||
return processProposalAssertions(fileText, ABSENT_LINE_PREFIX, ABSENT_JAVA_LINE_PREFIX, EXIST_JS_ONLY_LINE_PREFIX);
|
||||
case JS:
|
||||
return processProposalAssertions(fileText, ABSENT_LINE_PREFIX, ABSENT_JS_LINE_PREFIX);
|
||||
return processProposalAssertions(fileText, ABSENT_LINE_PREFIX, ABSENT_JS_LINE_PREFIX, EXIST_JAVA_ONLY_LINE_PREFIX);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("platform");
|
||||
@@ -191,7 +206,11 @@ public class ExpectedCompletionUtils {
|
||||
return InTextDirectivesUtils.getPrefixedInt(fileText, WITH_ORDER_PREFIX) != null;
|
||||
}
|
||||
|
||||
protected static void assertContainsRenderedItems(CompletionProposal[] expected, LookupElement[] items, boolean checkOrder) {
|
||||
public static void assertDirectivesValid(String fileText) {
|
||||
InTextDirectivesUtils.assertHasUnknownPrefixes(fileText, KNOWN_PREFIXES);
|
||||
}
|
||||
|
||||
public static void assertContainsRenderedItems(CompletionProposal[] expected, LookupElement[] items, boolean checkOrder) {
|
||||
List<CompletionProposal> itemsInformation = getItemsInformation(items);
|
||||
String allItemsString = listToString(itemsInformation);
|
||||
|
||||
@@ -230,7 +249,7 @@ public class ExpectedCompletionUtils {
|
||||
return InTextDirectivesUtils.getPrefixedInt(fileText, NUMBER_LINE_PREFIX);
|
||||
}
|
||||
|
||||
protected static void assertNotContainsRenderedItems(CompletionProposal[] unexpected,LookupElement[] items) {
|
||||
public static void assertNotContainsRenderedItems(CompletionProposal[] unexpected,LookupElement[] items) {
|
||||
List<CompletionProposal> itemsInformation = getItemsInformation(items);
|
||||
String allItemsString = listToString(itemsInformation);
|
||||
|
||||
@@ -242,7 +261,7 @@ public class ExpectedCompletionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
protected static List<CompletionProposal> getItemsInformation(LookupElement[] items) {
|
||||
public static List<CompletionProposal> getItemsInformation(LookupElement[] items) {
|
||||
LookupElementPresentation presentation = new LookupElementPresentation();
|
||||
|
||||
List<CompletionProposal> result = new ArrayList<CompletionProposal>();
|
||||
@@ -257,7 +276,7 @@ public class ExpectedCompletionUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static String listToString(Collection<CompletionProposal> items) {
|
||||
public static String listToString(Collection<CompletionProposal> items) {
|
||||
return StringUtil.join(
|
||||
Collections2.transform(items, new Function<CompletionProposal, String>() {
|
||||
@Override
|
||||
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.completion;
|
||||
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class JetBasicCompletionTest extends JetCompletionTestBase {
|
||||
public void testAutoCastAfterIf() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAutoCastAfterIfMethod() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAutoCastForThis() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAutoCastInWhen() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testBasicAny() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testBasicInt() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testBeforeDotInCall() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCallLocalLambda() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoNotCompleteForErrorReceivers() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtendClassName() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtendQualifiedClassName() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionFromStandardLibrary() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionFunReceiver() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionWithAdditionalTypeParameters() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionWithGenericParamInReceiver() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionWithGenericReceiver() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionWithInternalGenericParameters() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionWithManyTypeParamsInReceiver() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionForProperty() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFromImports() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFunctionCompletionFormatting() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInCallExpression() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInClassInitializer() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInClassPropertyAccessor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInEmptyImport() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInFileWithMultiDeclaration() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInFileWithTypedef() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInFunInClassInitializer() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInGlobalPropertyInitializer() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInImport() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInInitializerInPropertyAccessor() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInLocalObjectDeclaration() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInLongDotQualifiedExpression() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInMiddleOfNamespace() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInMiddleOfPackage() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInObjectInDelegationSpecifier() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInPackage() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInPackageBegin() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInTypeAnnotation() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testJavaClassNames() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testJavaPackage() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testLocalMultideclarationValues() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNamedObject() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoClassNameDuplication() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoClassNameDuplicationForRuntimeClass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoEmptyNamespace() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoImportedJavaClassDuplication() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoObjectInTypePosition() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoTopLevelCompletionInQualifiedUserTypes() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOnlyScopedClassesWithoutExplicit() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOverloadFunctions() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStandardJetArrayFirst() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStandardJetDoubleFirst() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSubpackageInFun() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTopLevelFromStandardLibrary() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTopLevelFromStandardLibraryWithoutParam() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVariableClassName() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVisibilityClassMembersFromExternal() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVisibilityClassMembersFromExternalForce() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVisibilityInSubclass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVisibilityInSubclassForce() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCompletionInSetter() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassRedeclaration1() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassRedeclaration2() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testObjectRedeclaration1() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testObjectRedeclaration2() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTopLevelNonImportedFun() {
|
||||
doTestWithJar();
|
||||
}
|
||||
|
||||
public void testTopLevelNonImportedExtFun() {
|
||||
doTestWithJar();
|
||||
}
|
||||
|
||||
public void doTestWithJar() {
|
||||
NewLibraryEditor editor = new NewLibraryEditor(null, null);
|
||||
editor.setName("doTestWithJarLib");
|
||||
editor.addRoot(VfsUtil.getUrlForLibraryRoot(new File(getTestDataPath() + "/" + getTestName(false) + ".jar")), OrderRootType.CLASSES);
|
||||
|
||||
try {
|
||||
ConfigLibraryUtil.configureLibrary(getModule(), getFullJavaJDK(), editor);
|
||||
doTest();
|
||||
}
|
||||
finally {
|
||||
ConfigLibraryUtil.unConfigureLibrary(getModule(), getFullJavaJDK(), editor.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return new File(PluginTestCaseBase.getTestDataPathBase(), "/completion/basic").getPath() +
|
||||
File.separator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.completion;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import org.jetbrains.jet.completion.AbstractJetJSCompletionTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({JetBasicJSCompletionTest.Basic.class, JetBasicJSCompletionTest.Js.class})
|
||||
public class JetBasicJSCompletionTest extends AbstractJetJSCompletionTest {
|
||||
@TestMetadata("idea/testData/completion/basic")
|
||||
public static class Basic extends AbstractJetJSCompletionTest {
|
||||
public void testAllFilesPresentInBasic() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/completion/basic"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastAfterIf.kt")
|
||||
public void testAutoCastAfterIf() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastAfterIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastAfterIfMethod.kt")
|
||||
public void testAutoCastAfterIfMethod() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastAfterIfMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastForThis.kt")
|
||||
public void testAutoCastForThis() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastForThis.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastInWhen.kt")
|
||||
public void testAutoCastInWhen() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastInWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("BasicAny.kt")
|
||||
public void testBasicAny() throws Exception {
|
||||
doTest("idea/testData/completion/basic/BasicAny.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("BasicInt.kt")
|
||||
public void testBasicInt() throws Exception {
|
||||
doTest("idea/testData/completion/basic/BasicInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("BeforeDotInCall.kt")
|
||||
public void testBeforeDotInCall() throws Exception {
|
||||
doTest("idea/testData/completion/basic/BeforeDotInCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("CallLocalLambda.kt")
|
||||
public void testCallLocalLambda() throws Exception {
|
||||
doTest("idea/testData/completion/basic/CallLocalLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassRedeclaration1.kt")
|
||||
public void testClassRedeclaration1() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ClassRedeclaration1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassRedeclaration2.kt")
|
||||
public void testClassRedeclaration2() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ClassRedeclaration2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("CompletionInSetter.kt")
|
||||
public void testCompletionInSetter() throws Exception {
|
||||
doTest("idea/testData/completion/basic/CompletionInSetter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DoNotCompleteForErrorReceivers.kt")
|
||||
public void testDoNotCompleteForErrorReceivers() throws Exception {
|
||||
doTest("idea/testData/completion/basic/DoNotCompleteForErrorReceivers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassName.kt")
|
||||
public void testExtendClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtendClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendQualifiedClassName.kt")
|
||||
public void testExtendQualifiedClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtendQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionForProperty.kt")
|
||||
public void testExtensionForProperty() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionForProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionFunReceiver.kt")
|
||||
public void testExtensionFunReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionFunReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithAdditionalTypeParameters.kt")
|
||||
public void testExtensionWithAdditionalTypeParameters() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithAdditionalTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithGenericParamInReceiver.kt")
|
||||
public void testExtensionWithGenericParamInReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithGenericParamInReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithGenericReceiver.kt")
|
||||
public void testExtensionWithGenericReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithGenericReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithInternalGenericParameters.kt")
|
||||
public void testExtensionWithInternalGenericParameters() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithInternalGenericParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithManyTypeParamsInReceiver.kt")
|
||||
public void testExtensionWithManyTypeParamsInReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithManyTypeParamsInReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FromImports.kt")
|
||||
public void testFromImports() throws Exception {
|
||||
doTest("idea/testData/completion/basic/FromImports.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionCompletionFormatting.kt")
|
||||
public void testFunctionCompletionFormatting() throws Exception {
|
||||
doTest("idea/testData/completion/basic/FunctionCompletionFormatting.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InCallExpression.kt")
|
||||
public void testInCallExpression() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InCallExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InClassInitializer.kt")
|
||||
public void testInClassInitializer() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InClassInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InClassPropertyAccessor.kt")
|
||||
public void testInClassPropertyAccessor() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InClassPropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InEmptyImport.kt")
|
||||
public void testInEmptyImport() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InEmptyImport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InFileWithMultiDeclaration.kt")
|
||||
public void testInFileWithMultiDeclaration() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InFileWithMultiDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InFileWithTypedef.kt")
|
||||
public void testInFileWithTypedef() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InFileWithTypedef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InFunInClassInitializer.kt")
|
||||
public void testInFunInClassInitializer() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InFunInClassInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InGlobalPropertyInitializer.kt")
|
||||
public void testInGlobalPropertyInitializer() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InGlobalPropertyInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InImport.kt")
|
||||
public void testInImport() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InImport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InInitializerInPropertyAccessor.kt")
|
||||
public void testInInitializerInPropertyAccessor() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InInitializerInPropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InLocalObjectDeclaration.kt")
|
||||
public void testInLocalObjectDeclaration() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InLocalObjectDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InLongDotQualifiedExpression.kt")
|
||||
public void testInLongDotQualifiedExpression() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InLongDotQualifiedExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InMiddleOfNamespace.kt")
|
||||
public void testInMiddleOfNamespace() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InMiddleOfNamespace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InMiddleOfPackage.kt")
|
||||
public void testInMiddleOfPackage() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InMiddleOfPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InObjectInDelegationSpecifier.kt")
|
||||
public void testInObjectInDelegationSpecifier() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InObjectInDelegationSpecifier.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InPackageBegin.kt")
|
||||
public void testInPackageBegin() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InPackageBegin.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InTypeAnnotation.kt")
|
||||
public void testInTypeAnnotation() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InTypeAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
doTest("idea/testData/completion/basic/JavaPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("LocalMultideclarationValues.kt")
|
||||
public void testLocalMultideclarationValues() throws Exception {
|
||||
doTest("idea/testData/completion/basic/LocalMultideclarationValues.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NamedObject.kt")
|
||||
public void testNamedObject() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NamedObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoClassNameDuplication.kt")
|
||||
public void testNoClassNameDuplication() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoClassNameDuplication.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoEmptyNamespace.kt")
|
||||
public void testNoEmptyNamespace() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoEmptyNamespace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoObjectInTypePosition.kt")
|
||||
public void testNoObjectInTypePosition() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoObjectInTypePosition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoTopLevelCompletionInQualifiedUserTypes.kt")
|
||||
public void testNoTopLevelCompletionInQualifiedUserTypes() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoTopLevelCompletionInQualifiedUserTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectRedeclaration1.kt")
|
||||
public void testObjectRedeclaration1() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ObjectRedeclaration1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectRedeclaration2.kt")
|
||||
public void testObjectRedeclaration2() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ObjectRedeclaration2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyScopedClassesWithoutExplicit.kt")
|
||||
public void testOnlyScopedClassesWithoutExplicit() throws Exception {
|
||||
doTest("idea/testData/completion/basic/OnlyScopedClassesWithoutExplicit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OverloadFunctions.kt")
|
||||
public void testOverloadFunctions() throws Exception {
|
||||
doTest("idea/testData/completion/basic/OverloadFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ShortClassNamesInTypePosition.kt")
|
||||
public void testShortClassNamesInTypePosition() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ShortClassNamesInTypePosition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StandardJetArrayFirst.kt")
|
||||
public void testStandardJetArrayFirst() throws Exception {
|
||||
doTest("idea/testData/completion/basic/StandardJetArrayFirst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StandardJetDoubleFirst.kt")
|
||||
public void testStandardJetDoubleFirst() throws Exception {
|
||||
doTest("idea/testData/completion/basic/StandardJetDoubleFirst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("SubpackageInFun.kt")
|
||||
public void testSubpackageInFun() throws Exception {
|
||||
doTest("idea/testData/completion/basic/SubpackageInFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VariableClassName.kt")
|
||||
public void testVariableClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VariableClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityClassMembersFromExternal.kt")
|
||||
public void testVisibilityClassMembersFromExternal() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityClassMembersFromExternal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityClassMembersFromExternalForce.kt")
|
||||
public void testVisibilityClassMembersFromExternalForce() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityClassMembersFromExternalForce.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityInSubclass.kt")
|
||||
public void testVisibilityInSubclass() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityInSubclass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityInSubclassForce.kt")
|
||||
public void testVisibilityInSubclassForce() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityInSubclassForce.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/completion/basic/js")
|
||||
public static class Js extends AbstractJetJSCompletionTest {
|
||||
public void testAllFilesPresentInJs() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/completion/basic/js"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("InPackage.kt")
|
||||
public void testInPackage() throws Exception {
|
||||
doTest("idea/testData/completion/basic/js/InPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JSStd.kt")
|
||||
public void testJSStd() throws Exception {
|
||||
doTest("idea/testData/completion/basic/js/JSStd.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("JetBasicJSCompletionTest");
|
||||
suite.addTestSuite(Basic.class);
|
||||
suite.addTestSuite(Js.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.completion;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import org.jetbrains.jet.completion.AbstractJavaCompletionTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({JetBasicJavaCompletionTest.Basic.class, JetBasicJavaCompletionTest.Java.class})
|
||||
public class JetBasicJavaCompletionTest extends AbstractJavaCompletionTest {
|
||||
@TestMetadata("idea/testData/completion/basic")
|
||||
public static class Basic extends AbstractJavaCompletionTest {
|
||||
public void testAllFilesPresentInBasic() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/completion/basic"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastAfterIf.kt")
|
||||
public void testAutoCastAfterIf() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastAfterIf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastAfterIfMethod.kt")
|
||||
public void testAutoCastAfterIfMethod() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastAfterIfMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastForThis.kt")
|
||||
public void testAutoCastForThis() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastForThis.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AutoCastInWhen.kt")
|
||||
public void testAutoCastInWhen() throws Exception {
|
||||
doTest("idea/testData/completion/basic/AutoCastInWhen.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("BasicAny.kt")
|
||||
public void testBasicAny() throws Exception {
|
||||
doTest("idea/testData/completion/basic/BasicAny.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("BasicInt.kt")
|
||||
public void testBasicInt() throws Exception {
|
||||
doTest("idea/testData/completion/basic/BasicInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("BeforeDotInCall.kt")
|
||||
public void testBeforeDotInCall() throws Exception {
|
||||
doTest("idea/testData/completion/basic/BeforeDotInCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("CallLocalLambda.kt")
|
||||
public void testCallLocalLambda() throws Exception {
|
||||
doTest("idea/testData/completion/basic/CallLocalLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassRedeclaration1.kt")
|
||||
public void testClassRedeclaration1() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ClassRedeclaration1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassRedeclaration2.kt")
|
||||
public void testClassRedeclaration2() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ClassRedeclaration2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("CompletionInSetter.kt")
|
||||
public void testCompletionInSetter() throws Exception {
|
||||
doTest("idea/testData/completion/basic/CompletionInSetter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DoNotCompleteForErrorReceivers.kt")
|
||||
public void testDoNotCompleteForErrorReceivers() throws Exception {
|
||||
doTest("idea/testData/completion/basic/DoNotCompleteForErrorReceivers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassName.kt")
|
||||
public void testExtendClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtendClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendQualifiedClassName.kt")
|
||||
public void testExtendQualifiedClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtendQualifiedClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionForProperty.kt")
|
||||
public void testExtensionForProperty() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionForProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionFunReceiver.kt")
|
||||
public void testExtensionFunReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionFunReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithAdditionalTypeParameters.kt")
|
||||
public void testExtensionWithAdditionalTypeParameters() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithAdditionalTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithGenericParamInReceiver.kt")
|
||||
public void testExtensionWithGenericParamInReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithGenericParamInReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithGenericReceiver.kt")
|
||||
public void testExtensionWithGenericReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithGenericReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithInternalGenericParameters.kt")
|
||||
public void testExtensionWithInternalGenericParameters() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithInternalGenericParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionWithManyTypeParamsInReceiver.kt")
|
||||
public void testExtensionWithManyTypeParamsInReceiver() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ExtensionWithManyTypeParamsInReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FromImports.kt")
|
||||
public void testFromImports() throws Exception {
|
||||
doTest("idea/testData/completion/basic/FromImports.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionCompletionFormatting.kt")
|
||||
public void testFunctionCompletionFormatting() throws Exception {
|
||||
doTest("idea/testData/completion/basic/FunctionCompletionFormatting.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InCallExpression.kt")
|
||||
public void testInCallExpression() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InCallExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InClassInitializer.kt")
|
||||
public void testInClassInitializer() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InClassInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InClassPropertyAccessor.kt")
|
||||
public void testInClassPropertyAccessor() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InClassPropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InEmptyImport.kt")
|
||||
public void testInEmptyImport() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InEmptyImport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InFileWithMultiDeclaration.kt")
|
||||
public void testInFileWithMultiDeclaration() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InFileWithMultiDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InFileWithTypedef.kt")
|
||||
public void testInFileWithTypedef() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InFileWithTypedef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InFunInClassInitializer.kt")
|
||||
public void testInFunInClassInitializer() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InFunInClassInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InGlobalPropertyInitializer.kt")
|
||||
public void testInGlobalPropertyInitializer() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InGlobalPropertyInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InImport.kt")
|
||||
public void testInImport() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InImport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InInitializerInPropertyAccessor.kt")
|
||||
public void testInInitializerInPropertyAccessor() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InInitializerInPropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InLocalObjectDeclaration.kt")
|
||||
public void testInLocalObjectDeclaration() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InLocalObjectDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InLongDotQualifiedExpression.kt")
|
||||
public void testInLongDotQualifiedExpression() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InLongDotQualifiedExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InMiddleOfNamespace.kt")
|
||||
public void testInMiddleOfNamespace() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InMiddleOfNamespace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InMiddleOfPackage.kt")
|
||||
public void testInMiddleOfPackage() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InMiddleOfPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InObjectInDelegationSpecifier.kt")
|
||||
public void testInObjectInDelegationSpecifier() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InObjectInDelegationSpecifier.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InPackageBegin.kt")
|
||||
public void testInPackageBegin() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InPackageBegin.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InTypeAnnotation.kt")
|
||||
public void testInTypeAnnotation() throws Exception {
|
||||
doTest("idea/testData/completion/basic/InTypeAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JavaPackage.kt")
|
||||
public void testJavaPackage() throws Exception {
|
||||
doTest("idea/testData/completion/basic/JavaPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("LocalMultideclarationValues.kt")
|
||||
public void testLocalMultideclarationValues() throws Exception {
|
||||
doTest("idea/testData/completion/basic/LocalMultideclarationValues.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NamedObject.kt")
|
||||
public void testNamedObject() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NamedObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoClassNameDuplication.kt")
|
||||
public void testNoClassNameDuplication() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoClassNameDuplication.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoEmptyNamespace.kt")
|
||||
public void testNoEmptyNamespace() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoEmptyNamespace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoObjectInTypePosition.kt")
|
||||
public void testNoObjectInTypePosition() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoObjectInTypePosition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoTopLevelCompletionInQualifiedUserTypes.kt")
|
||||
public void testNoTopLevelCompletionInQualifiedUserTypes() throws Exception {
|
||||
doTest("idea/testData/completion/basic/NoTopLevelCompletionInQualifiedUserTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectRedeclaration1.kt")
|
||||
public void testObjectRedeclaration1() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ObjectRedeclaration1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectRedeclaration2.kt")
|
||||
public void testObjectRedeclaration2() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ObjectRedeclaration2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlyScopedClassesWithoutExplicit.kt")
|
||||
public void testOnlyScopedClassesWithoutExplicit() throws Exception {
|
||||
doTest("idea/testData/completion/basic/OnlyScopedClassesWithoutExplicit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OverloadFunctions.kt")
|
||||
public void testOverloadFunctions() throws Exception {
|
||||
doTest("idea/testData/completion/basic/OverloadFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ShortClassNamesInTypePosition.kt")
|
||||
public void testShortClassNamesInTypePosition() throws Exception {
|
||||
doTest("idea/testData/completion/basic/ShortClassNamesInTypePosition.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StandardJetArrayFirst.kt")
|
||||
public void testStandardJetArrayFirst() throws Exception {
|
||||
doTest("idea/testData/completion/basic/StandardJetArrayFirst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StandardJetDoubleFirst.kt")
|
||||
public void testStandardJetDoubleFirst() throws Exception {
|
||||
doTest("idea/testData/completion/basic/StandardJetDoubleFirst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("SubpackageInFun.kt")
|
||||
public void testSubpackageInFun() throws Exception {
|
||||
doTest("idea/testData/completion/basic/SubpackageInFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VariableClassName.kt")
|
||||
public void testVariableClassName() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VariableClassName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityClassMembersFromExternal.kt")
|
||||
public void testVisibilityClassMembersFromExternal() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityClassMembersFromExternal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityClassMembersFromExternalForce.kt")
|
||||
public void testVisibilityClassMembersFromExternalForce() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityClassMembersFromExternalForce.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityInSubclass.kt")
|
||||
public void testVisibilityInSubclass() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityInSubclass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityInSubclassForce.kt")
|
||||
public void testVisibilityInSubclassForce() throws Exception {
|
||||
doTest("idea/testData/completion/basic/VisibilityInSubclassForce.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/completion/basic/java")
|
||||
public static class Java extends AbstractJavaCompletionTest {
|
||||
public void testAllFilesPresentInJava() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/completion/basic/java"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionFromStandardLibrary.kt")
|
||||
public void testExtensionFromStandardLibrary() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/ExtensionFromStandardLibrary.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InPackage.kt")
|
||||
public void testInPackage() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/InPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JavaClassNames.kt")
|
||||
public void testJavaClassNames() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/JavaClassNames.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoClassNameDuplicationForRuntimeClass.kt")
|
||||
public void testNoClassNameDuplicationForRuntimeClass() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/NoClassNameDuplicationForRuntimeClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoImportedJavaClassDuplication.kt")
|
||||
public void testNoImportedJavaClassDuplication() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/NoImportedJavaClassDuplication.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFromStandardLibrary.kt")
|
||||
public void testTopLevelFromStandardLibrary() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/TopLevelFromStandardLibrary.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFromStandardLibraryWithoutParam.kt")
|
||||
public void testTopLevelFromStandardLibraryWithoutParam() throws Exception {
|
||||
doTest("idea/testData/completion/basic/java/TopLevelFromStandardLibraryWithoutParam.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("JetBasicJavaCompletionTest");
|
||||
suite.addTestSuite(Basic.class);
|
||||
suite.addTestSuite(Java.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.completion;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetStdJSProjectDescriptor;
|
||||
|
||||
public abstract class JetFixtureCompletionBaseTestCase extends LightCodeInsightFixtureTestCase {
|
||||
private boolean autocompleteSetting;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
autocompleteSetting = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION;
|
||||
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = autocompleteSetting;
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public abstract ExpectedCompletionUtils.Platform getPlatform();
|
||||
|
||||
public void doTest(String testPath) {
|
||||
myFixture.configureByFile(testPath);
|
||||
|
||||
String fileText = myFixture.getFile().getText();
|
||||
|
||||
Integer completionTime = ExpectedCompletionUtils.getExecutionTime(fileText);
|
||||
|
||||
myFixture.complete(CompletionType.BASIC, completionTime == null ? 0 : completionTime);
|
||||
|
||||
ExpectedCompletionUtils.assertDirectivesValid(fileText);
|
||||
|
||||
ExpectedCompletionUtils.CompletionProposal[] expected = ExpectedCompletionUtils.itemsShouldExist(fileText, getPlatform());
|
||||
ExpectedCompletionUtils.CompletionProposal[] unexpected = ExpectedCompletionUtils.itemsShouldAbsent(fileText, getPlatform());
|
||||
Integer itemsNumber = ExpectedCompletionUtils.getExpectedNumber(fileText, getPlatform());
|
||||
|
||||
assertTrue("Should be some assertions about completion",
|
||||
expected.length != 0 || unexpected.length != 0 || itemsNumber != null);
|
||||
|
||||
LookupElement[] items = myFixture.getLookupElements();
|
||||
|
||||
if (items == null) {
|
||||
items = new LookupElement[0];
|
||||
}
|
||||
|
||||
ExpectedCompletionUtils.assertContainsRenderedItems(expected, items, ExpectedCompletionUtils.isWithOrder(fileText));
|
||||
ExpectedCompletionUtils.assertNotContainsRenderedItems(unexpected, items);
|
||||
|
||||
if (itemsNumber != null) {
|
||||
assertEquals(
|
||||
String.format(
|
||||
"Invalid number of completion items: %s",
|
||||
ExpectedCompletionUtils.listToString(ExpectedCompletionUtils.getItemsInformation(items))),
|
||||
itemsNumber.intValue(), items.length);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JetStdJSProjectDescriptor.INSTANCE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user