Test for completion of kotlin binaries in java.
This commit is contained in:
committed by
Pavel V. Talanov
parent
816e9975ad
commit
e4b9c7fd40
@@ -86,6 +86,7 @@ import org.jetbrains.jet.completion.handlers.AbstractSmartCompletionHandlerTest
|
||||
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
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -443,6 +444,10 @@ fun main(args: Array<String>) {
|
||||
testClass(javaClass<AbstractShortenRefsTest>()) {
|
||||
model("shortenRefs")
|
||||
}
|
||||
|
||||
testClass(javaClass<AbstractCompiledKotlinInJavaCompletionTest>()) {
|
||||
model("completion/injava/compiled", extension = "java")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("j2k/tests/test", "j2k/tests/testData") {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Testing {
|
||||
public static void test() {
|
||||
Li<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: LibClass
|
||||
// EXIST: LibTrait
|
||||
// EXIST: LibEnum
|
||||
@@ -0,0 +1,7 @@
|
||||
public class Testing {
|
||||
public static void test(mockLib.foo.LibClass p) {
|
||||
p.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: foo
|
||||
@@ -0,0 +1,14 @@
|
||||
public class Testing {
|
||||
public static void test() {
|
||||
mockLib.foo.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// note: "NUMBER" check also assures that FooPackage$src$ classes are not visible
|
||||
|
||||
// EXIST: LibClass
|
||||
// EXIST: LibTrait
|
||||
// EXIST: LibEnum
|
||||
// EXIST: LibObject
|
||||
// EXIST: FooPackage
|
||||
// NUMBER: 5
|
||||
@@ -0,0 +1,7 @@
|
||||
public class Testing {
|
||||
public static void test() {
|
||||
mockLib.foo.LibEnum.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: RED, GREEN, BLUE
|
||||
@@ -0,0 +1,7 @@
|
||||
public class Testing {
|
||||
public static void test() {
|
||||
mockLib.foo.LibObject.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: instance$
|
||||
@@ -0,0 +1,7 @@
|
||||
public class Testing {
|
||||
public static void test() {
|
||||
mockLib.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: foo
|
||||
@@ -0,0 +1,10 @@
|
||||
public class Testing {
|
||||
public static void test() {
|
||||
mockLib.foo.FooPackage.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: topLevelFunction
|
||||
// EXIST: topLevelExtFunction
|
||||
// EXIST: getTopLevelVar, setTopLevelVar
|
||||
// EXIST: anotherTopLevelFunction
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Testing {
|
||||
void f(mockLib.foo.LibTrait p) {
|
||||
p.<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: foo
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package mockLib.foo
|
||||
|
||||
public fun anotherTopLevelFunction(): String = ""
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package mockLib.foo
|
||||
|
||||
public class LibClass {
|
||||
public fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
public trait LibTrait {
|
||||
public fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
public enum class LibEnum {
|
||||
RED
|
||||
GREEN
|
||||
BLUE
|
||||
}
|
||||
|
||||
public object LibObject
|
||||
|
||||
public fun topLevelFunction(): String = ""
|
||||
|
||||
public fun String.topLevelExtFunction(): String = ""
|
||||
|
||||
public var topLevelVar: String = ""
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package org.jetbrains.jet.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JdkAndMockLibraryProjectDescriptor;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.plugin.project.TargetPlatform;
|
||||
|
||||
public abstract class AbstractCompiledKotlinInJavaCompletionTest extends JetFixtureCompletionBaseTestCase {
|
||||
@Override
|
||||
public TargetPlatform getPlatform() {
|
||||
return TargetPlatform.JVM;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return new JdkAndMockLibraryProjectDescriptor(PluginTestCaseBase.getTestDataPathBase() + "/completion/injava/compiled/mockLib", false);
|
||||
}
|
||||
|
||||
@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.AbstractCompiledKotlinInJavaCompletionTest;
|
||||
|
||||
/** 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 CompiledKotlinInJavaCompletionTestGenerated extends AbstractCompiledKotlinInJavaCompletionTest {
|
||||
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("CompiledKotlinInJavaCompletionTestGenerated");
|
||||
suite.addTestSuite(CompiledKotlinInJavaCompletionTestGenerated.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user