Test for completion of kotlin sources in java. Reused same test data.
This commit is contained in:
committed by
Pavel V. Talanov
parent
e4b9c7fd40
commit
a75490803a
@@ -87,6 +87,7 @@ import org.jetbrains.jet.generators.tests.generator.TestGeneratorUtil
|
||||
import org.jetbrains.jet.resolve.AbstractAdditionalLazyResolveDescriptorRendererTest
|
||||
import org.jetbrains.jet.resolve.AbstractReferenceResolveInLibrarySourcesTest
|
||||
import org.jetbrains.jet.completion.AbstractCompiledKotlinInJavaCompletionTest
|
||||
import org.jetbrains.jet.completion.AbstractKotlinSourceInJavaCompletionTest
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -448,6 +449,10 @@ fun main(args: Array<String>) {
|
||||
testClass(javaClass<AbstractCompiledKotlinInJavaCompletionTest>()) {
|
||||
model("completion/injava/compiled", extension = "java")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractKotlinSourceInJavaCompletionTest>()) {
|
||||
model("completion/injava/compiled", extension = "java")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("j2k/tests/test", "j2k/tests/testData") {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.jetbrains.jet.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.plugin.project.TargetPlatform;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class AbstractKotlinSourceInJavaCompletionTest extends JetFixtureCompletionBaseTestCase {
|
||||
@Override
|
||||
public TargetPlatform getPlatform() {
|
||||
return TargetPlatform.JVM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTest(String testPath) {
|
||||
File mockLibDir = new File(PluginTestCaseBase.getTestDataPathBase() + "/completion/injava/compiled/mockLib");
|
||||
File[] listFiles = mockLibDir.listFiles();
|
||||
assertNotNull(listFiles);
|
||||
String[] paths = ArrayUtil.toStringArray(ContainerUtil.map(listFiles, new Function<File, String>() {
|
||||
@Override
|
||||
public String fun(File file) {
|
||||
return FileUtil.toSystemIndependentName(file.getAbsolutePath());
|
||||
}
|
||||
}));
|
||||
myFixture.configureByFiles(paths);
|
||||
super.doTest(testPath);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected CompletionType completionType() {
|
||||
return CompletionType.BASIC;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.AbstractKotlinSourceInJavaCompletionTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/testData/completion/injava/compiled")
|
||||
@InnerTestClasses({})
|
||||
public class KotlinSourceInJavaCompletionTestGenerated extends AbstractKotlinSourceInJavaCompletionTest {
|
||||
public void testAllFilesPresentInCompiled() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/completion/injava/compiled"), Pattern.compile("^(.+)\\.java$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("Class.java")
|
||||
public void testClass() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/Class.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassMembers.java")
|
||||
public void testClassMembers() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/ClassMembers.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassesFromNamespace.java")
|
||||
public void testClassesFromNamespace() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/ClassesFromNamespace.java");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumConstants.java")
|
||||
public void testEnumConstants() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/EnumConstants.java");
|
||||
}
|
||||
|
||||
@TestMetadata("ObjectInstance.java")
|
||||
public void testObjectInstance() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/ObjectInstance.java");
|
||||
}
|
||||
|
||||
@TestMetadata("Subpackage.java")
|
||||
public void testSubpackage() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/Subpackage.java");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelMembers.java")
|
||||
public void testTopLevelMembers() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/TopLevelMembers.java");
|
||||
}
|
||||
|
||||
@TestMetadata("TraitMember.java")
|
||||
public void testTraitMember() throws Exception {
|
||||
doTest("idea/testData/completion/injava/compiled/TraitMember.java");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("KotlinSourceInJavaCompletionTestGenerated");
|
||||
suite.addTestSuite(KotlinSourceInJavaCompletionTestGenerated.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user