Switch JetMultifileBasicCompletionTest to generated approach
This commit is contained in:
@@ -103,6 +103,7 @@ import org.jetbrains.jet.plugin.debugger.AbstractSmartStepIntoTest
|
||||
import org.jetbrains.jet.plugin.stubs.AbstractStubBuilderTest
|
||||
import org.jetbrains.jet.plugin.codeInsight.AbstractJetInspectionTest
|
||||
import org.jetbrains.jet.plugin.debugger.AbstractKotlinSteppingTest
|
||||
import org.jetbrains.jet.completion.AbstractMultiFileJvmBasicCompletionTest
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -549,6 +550,10 @@ fun main(args: Array<String>) {
|
||||
testClass(javaClass<AbstractStubBuilderTest>()) {
|
||||
model("stubs", extension = "kt")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractMultiFileJvmBasicCompletionTest>()) {
|
||||
model("completion/basic/multifile", pattern = """^([^\.]+)\.kt$""")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("j2k/tests/test", "j2k/tests/testData") {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package second
|
||||
|
||||
class Some
|
||||
|
||||
// Two function to prevent automatic insert
|
||||
fun Some.extensionFunction1() = 12
|
||||
fun Some.extensionFunction2() = 12
|
||||
|
||||
fun foo() = Some()
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package second
|
||||
|
||||
class Some
|
||||
|
||||
// Two function to prevent automatic insert
|
||||
fun Some.extensionFunction1(): Int = 12
|
||||
fun Some.extensionFunction2(): Int = 12
|
||||
|
||||
fun foo(): Some = Some()
|
||||
@@ -1,11 +0,0 @@
|
||||
package first
|
||||
|
||||
fun firstFun() {
|
||||
val a = SomeUnknownClass()
|
||||
a.hello<caret>
|
||||
}
|
||||
|
||||
// ABSENT: helloFun
|
||||
// ABSENT: helloFunPreventAutoInsert
|
||||
// ABSENT: helloWithParams
|
||||
// NUMBER: 0
|
||||
@@ -1,11 +0,0 @@
|
||||
package second
|
||||
|
||||
fun String.helloFun() {
|
||||
}
|
||||
|
||||
fun String.helloWithParams(i : Int) : String {
|
||||
return ""
|
||||
}
|
||||
|
||||
fun String.helloFunPreventAutoInsert() {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package first
|
||||
|
||||
import second.SomeTestClass
|
||||
|
||||
fun firstFun() {
|
||||
SomeTestClass().some<caret>
|
||||
}
|
||||
|
||||
// EXIST: someProperty
|
||||
// EXIST: someOtherProperty
|
||||
// EXIST: someSelfProperty
|
||||
// NUMBER: 3
|
||||
@@ -1,8 +0,0 @@
|
||||
package second
|
||||
|
||||
class SomeTestClass() {
|
||||
}
|
||||
|
||||
val SomeTestClass.someProperty = 12
|
||||
var SomeTestClass.someOtherProperty = ""
|
||||
val SomeTestClass.someSelfProperty = SomeTestClass()
|
||||
+1
-1
@@ -6,4 +6,4 @@ class Some {
|
||||
fun testFunction2() : Int = 12
|
||||
}
|
||||
|
||||
fun someWithLiteral(body: (Some) -> Unit) = 12
|
||||
fun someWithLiteral(body: (Some) -> Unit): Int = 12
|
||||
+10
-13
@@ -27,34 +27,31 @@ import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class JetCompletionMultiTestBase extends JetFixtureCompletionBaseTestCase {
|
||||
public abstract class AbstractMultiFileJvmBasicCompletionTest extends JetFixtureCompletionBaseTestCase {
|
||||
|
||||
public static final String JAVA_FILE = "JAVA_FILE:";
|
||||
|
||||
protected void doTest() {
|
||||
doTest(getTestName(false));
|
||||
}
|
||||
private static final String JAVA_FILE = "JAVA_FILE:";
|
||||
|
||||
@Override
|
||||
protected void setUpFixture(@NotNull String testPath) {
|
||||
myFixture.configureByFiles(getFileNameList(testPath));
|
||||
String[] kotlinTestFiles = getKotlinFiles(testPath);
|
||||
myFixture.configureByFiles(kotlinTestFiles);
|
||||
PsiFile testFile = myFixture.getFile();
|
||||
String text = testFile.getText();
|
||||
String javaFilePath = InTextDirectivesUtils.findStringWithPrefixes(text, JAVA_FILE);
|
||||
if (javaFilePath != null) {
|
||||
myFixture.configureByFile(javaFilePath);
|
||||
myFixture.configureByFiles(getFileNameList(testPath));
|
||||
myFixture.configureByFiles(kotlinTestFiles);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String[] getFileNameList(@NotNull String testPath) {
|
||||
String baseFile = testPath + "-1.kt";
|
||||
String secondaryFile = testPath + "-2.kt";
|
||||
private String[] getKotlinFiles(@NotNull String testPath) {
|
||||
String testFileName = testPath.substring(testPath.lastIndexOf("/") + 1, testPath.length());
|
||||
String secondaryFile = testFileName.replace(".kt", ".dependency.kt");
|
||||
if (new File(getTestDataPath() + "/" + secondaryFile).exists()) {
|
||||
return new String[] {baseFile, secondaryFile};
|
||||
return new String[] {testFileName, secondaryFile};
|
||||
}
|
||||
return new String[] {baseFile};
|
||||
return new String[] {testFileName};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,75 +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;
|
||||
|
||||
public class JetMultifileBasicCompletionTest extends JetCompletionMultiTestBase {
|
||||
public void testCompleteImportedFunction() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCompletionOnImportedFunction() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoNotCompleteWithConstraints() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTopLevelFunction() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionFunctionOnImportedFunction() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void todotestExtensionFunctionOnUnresolved() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionOnNullable() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void todotestExtensionProperty() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotImportedJavaClass() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInImportedFunctionLiteralParameter() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testJavaInnerClasses() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotImportedExtensionFunction() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtensionFunction() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotImportedObject() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.AbstractMultiFileJvmBasicCompletionTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/completion/basic/multifile")
|
||||
@InnerTestClasses({})
|
||||
public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJvmBasicCompletionTest {
|
||||
public void testAllFilesPresentInMultifile() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/completion/basic/multifile"), Pattern.compile("^([^\\.]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("CompleteImportedFunction.kt")
|
||||
public void testCompleteImportedFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/CompleteImportedFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("CompletionOnImportedFunction.kt")
|
||||
public void testCompletionOnImportedFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/CompletionOnImportedFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DoNotCompleteWithConstraints.kt")
|
||||
public void testDoNotCompleteWithConstraints() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/DoNotCompleteWithConstraints.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/ExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionFunctionOnImportedFunction.kt")
|
||||
public void testExtensionFunctionOnImportedFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/ExtensionFunctionOnImportedFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtensionOnNullable.kt")
|
||||
public void testExtensionOnNullable() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/ExtensionOnNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InImportedFunctionLiteralParameter.kt")
|
||||
public void testInImportedFunctionLiteralParameter() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/InImportedFunctionLiteralParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JavaInnerClasses.kt")
|
||||
public void testJavaInnerClasses() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/JavaInnerClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NotImportedExtensionFunction.kt")
|
||||
public void testNotImportedExtensionFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/NotImportedExtensionFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NotImportedJavaClass.kt")
|
||||
public void testNotImportedJavaClass() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/NotImportedJavaClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NotImportedObject.kt")
|
||||
public void testNotImportedObject() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/NotImportedObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunction.kt")
|
||||
public void testTopLevelFunction() throws Exception {
|
||||
doTest("idea/testData/completion/basic/multifile/TopLevelFunction.kt");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("MultiFileJvmBasicCompletionTestGenerated");
|
||||
suite.addTestSuite(MultiFileJvmBasicCompletionTestGenerated.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user