From b056fd7e2e67ee48e8cd5ab096892ad430480eb7 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Tue, 2 Dec 2014 14:01:58 +0300 Subject: [PATCH] Add test for completion with runtime type cast --- .../jet/generators/tests/GenerateTests.kt | 5 ++ .../runtimeType/castWithGenerics.kt | 21 +++++++ .../runtimeType/castWithGenerics.kt.fragment | 1 + .../runtimeType/complexHierarchy.kt | 25 +++++++++ .../runtimeType/complexHierarchy.kt.fragment | 1 + .../runtimeType/extensionMethod.kt | 20 +++++++ .../runtimeType/extensionMethod.kt.fragment | 1 + .../codeFragments/runtimeType/runtimeCast.kt | 24 ++++++++ .../runtimeType/runtimeCast.kt.fragment | 1 + .../handlers/runtimeCast/CastPrivateFun.kt | 14 +++++ .../runtimeCast/CastPrivateFun.kt.after | 1 + .../runtimeCast/CastPrivateFun.kt.fragment | 1 + .../handlers/runtimeCast/InsertExtFunction.kt | 12 ++++ .../runtimeCast/InsertExtFunction.kt.after | 1 + .../runtimeCast/InsertExtFunction.kt.fragment | 1 + .../handlers/runtimeCast/InsertFunction.kt | 12 ++++ .../runtimeCast/InsertFunction.kt.after | 1 + .../runtimeCast/InsertFunction.kt.fragment | 1 + .../completion/ExpectedCompletionUtils.java | 3 + .../AbstractSmartCompletionHandlerTest.kt | 10 +++- ...AbstractEditorForEvaluateExpressionTest.kt | 28 ++++++++++ ...ragmentCompletionHandlerTestGenerated.java | 56 +++++++++++++++++++ .../CodeFragmentCompletionTestGenerated.java | 34 +++++++++++ 23 files changed, 272 insertions(+), 2 deletions(-) create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt.fragment create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt.fragment create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt.fragment create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt create mode 100644 idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt.fragment create mode 100644 idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt create mode 100644 idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.after create mode 100644 idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.fragment create mode 100644 idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt create mode 100644 idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.after create mode 100644 idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.fragment create mode 100644 idea/testData/completion/handlers/runtimeCast/InsertFunction.kt create mode 100644 idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.after create mode 100644 idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.fragment create mode 100644 idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionHandlerTestGenerated.java diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index 20118c15062..b1e1f67ddc2 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -134,6 +134,7 @@ import org.jetbrains.jet.completion.handlers.AbstractCompletionCharFilterTest import org.jetbrains.jet.resolve.AbstractPartialBodyResolveTest import org.jetbrains.jet.checkers.AbstractJetDiagnosticsTestWithJsStdLib import org.jetbrains.jet.types.AbstractJetTypeBindingTest +import org.jetbrains.jet.plugin.debugger.evaluate.AbstractCodeFragmentCompletionHandlerTest fun main(args: Array) { System.setProperty("java.awt.headless", "true") @@ -377,6 +378,10 @@ fun main(args: Array) { model("completion/handlers/charFilter") } + testClass(javaClass()) { + model("completion/handlers/runtimeCast") + } + testClass(javaClass()) { model("completion/basic/codeFragments", extension = "kt") } diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt b/idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt new file mode 100644 index 00000000000..5e4e3eb35e7 --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt @@ -0,0 +1,21 @@ +fun main(args: Array) { + val b: Base = Derived() + val a = 1 +} + +open class Base { + fun funInBase(t: T): T { return t } + + open fun funWithOverride(t: T): T { return t } + open fun funWithoutOverride(t: T): T { return t } +} + +class Derived: Base() { + override fun funWithOverride(t: String): String { return "a" } +} + +// INVOCATION_COUNT: 1 +// EXIST: funInBase, funWithOverride, funWithoutOverride +// NUMBER: 3 + +// RUNTIME_TYPE: Derived diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt.fragment b/idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt.fragment new file mode 100644 index 00000000000..a51e326b1ec --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt.fragment @@ -0,0 +1 @@ +b.fun \ No newline at end of file diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt b/idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt new file mode 100644 index 00000000000..03a2388b385 --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt @@ -0,0 +1,25 @@ +fun main(args: Array) { + val b: A = C() + val a = 1 +} + +open class A { + fun funA() {} + private fun funAp() {} +} + +open class B: A() { + fun funB() {} + private fun funBp() {} +} + +class C: B() { + fun funC() {} + private fun funCp() {} +} + +// INVOCATION_COUNT: 2 +// EXIST: funA, funAp, funB, funBp, funC, funCp +// NUMBER: 6 + +// RUNTIME_TYPE: C diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt.fragment b/idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt.fragment new file mode 100644 index 00000000000..a51e326b1ec --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt.fragment @@ -0,0 +1 @@ +b.fun \ No newline at end of file diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt b/idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt new file mode 100644 index 00000000000..dd9087661ad --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt @@ -0,0 +1,20 @@ +fun main(args: Array) { + val b: Base = Derived() + val a = 1 +} + +open class Base { +} + +class Derived: Base() { +} + +fun Derived.funExtDerived() { } +fun Base.funExtBase() { } + +// INVOCATION_COUNT: 1 +// EXIST: funExtBase, funExtDerived +// NUMBER: 2 + + +// RUNTIME_TYPE: Derived \ No newline at end of file diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt.fragment b/idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt.fragment new file mode 100644 index 00000000000..a51e326b1ec --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt.fragment @@ -0,0 +1 @@ +b.fun \ No newline at end of file diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt b/idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt new file mode 100644 index 00000000000..6d666c34613 --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt @@ -0,0 +1,24 @@ +fun main(args: Array) { + val b: Base = Derived() + val a = 1 +} + +open class Base { + fun funInBase() {} + + open fun funWithOverride() { } + open fun funWithoutOverride() { } +} + +class Derived: Base() { + fun funInDerived() { } + + override fun funWithOverride() { } +} + +// INVOCATION_COUNT: 1 +// EXIST: funInBase, funWithOverride, funWithoutOverride, funInDerived +// NUMBER: 4 + + +// RUNTIME_TYPE: Derived \ No newline at end of file diff --git a/idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt.fragment b/idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt.fragment new file mode 100644 index 00000000000..a51e326b1ec --- /dev/null +++ b/idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt.fragment @@ -0,0 +1 @@ +b.fun \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt b/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt new file mode 100644 index 00000000000..4d66f760a1d --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt @@ -0,0 +1,14 @@ +fun main(args: Array) { + val b: A = C() + val a = 1 +} + +open class A +open class B { + private fun funInB() {} +} + +class C: B() + +// INVOCATION_COUNT: 2 +// RUNTIME_TYPE: C \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.after b/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.after new file mode 100644 index 00000000000..f90b0b641ab --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.after @@ -0,0 +1 @@ +(b as B).funInB() \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.fragment b/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.fragment new file mode 100644 index 00000000000..86b50b3dcea --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt.fragment @@ -0,0 +1 @@ +b.funIn \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt b/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt new file mode 100644 index 00000000000..e7f9bbe5a05 --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt @@ -0,0 +1,12 @@ +fun main(args: Array) { + val b: Base = Derived() + val a = 1 +} + +open class Base + +class Derived: Base() + +fun Derived.funInDerived() { } + +// RUNTIME_TYPE: Derived \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.after b/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.after new file mode 100644 index 00000000000..0c350ee31f2 --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.after @@ -0,0 +1 @@ +(b as Derived).funInDerived() \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.fragment b/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.fragment new file mode 100644 index 00000000000..86b50b3dcea --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt.fragment @@ -0,0 +1 @@ +b.funIn \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt b/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt new file mode 100644 index 00000000000..b1ea56a283a --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt @@ -0,0 +1,12 @@ +fun main(args: Array) { + val b: Base = Derived() + val a = 1 +} + +open class Base + +class Derived: Base() { + fun funInDerived() { } +} + +// RUNTIME_TYPE: Derived \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.after b/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.after new file mode 100644 index 00000000000..0c350ee31f2 --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.after @@ -0,0 +1 @@ +(b as Derived).funInDerived() \ No newline at end of file diff --git a/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.fragment b/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.fragment new file mode 100644 index 00000000000..86b50b3dcea --- /dev/null +++ b/idea/testData/completion/handlers/runtimeCast/InsertFunction.kt.fragment @@ -0,0 +1 @@ +b.funIn \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/completion/ExpectedCompletionUtils.java b/idea/tests/org/jetbrains/jet/completion/ExpectedCompletionUtils.java index 74577734976..f87f408cdd3 100644 --- a/idea/tests/org/jetbrains/jet/completion/ExpectedCompletionUtils.java +++ b/idea/tests/org/jetbrains/jet/completion/ExpectedCompletionUtils.java @@ -123,6 +123,8 @@ public class ExpectedCompletionUtils { private static final String WITH_ORDER_PREFIX = "WITH_ORDER:"; private static final String AUTOCOMPLETE_SETTING_PREFIX = "AUTOCOMPLETE_SETTING:"; + public static final String RUNTIME_TYPE = "RUNTIME_TYPE:"; + public static final List KNOWN_PREFIXES = ImmutableList.of( EXIST_LINE_PREFIX, ABSENT_LINE_PREFIX, @@ -136,6 +138,7 @@ public class ExpectedCompletionUtils { INVOCATION_COUNT_PREFIX, WITH_ORDER_PREFIX, AUTOCOMPLETE_SETTING_PREFIX, + RUNTIME_TYPE, AstAccessControl.INSTANCE$.getALLOW_AST_ACCESS_DIRECTIVE()); @NotNull diff --git a/idea/tests/org/jetbrains/jet/completion/handlers/AbstractSmartCompletionHandlerTest.kt b/idea/tests/org/jetbrains/jet/completion/handlers/AbstractSmartCompletionHandlerTest.kt index c70a815f0fd..48915e3cb90 100644 --- a/idea/tests/org/jetbrains/jet/completion/handlers/AbstractSmartCompletionHandlerTest.kt +++ b/idea/tests/org/jetbrains/jet/completion/handlers/AbstractSmartCompletionHandlerTest.kt @@ -18,6 +18,8 @@ package org.jetbrains.jet.completion.handlers import com.intellij.codeInsight.completion.CompletionType import org.jetbrains.jet.InTextDirectivesUtils +import com.intellij.openapi.util.io.FileUtil +import java.io.File public abstract class AbstractCompletionHandlerTest() : CompletionHandlerTestBase() { private val INVOCATION_COUNT_PREFIX = "INVOCATION_COUNT:" @@ -28,9 +30,9 @@ public abstract class AbstractCompletionHandlerTest() : CompletionHandlerTestBas private val COMPLETION_TYPE_PREFIX = "COMPLETION_TYPE:" protected fun doTest(testPath: String) { - fixture.configureByFile(testPath) + setUpFixture(testPath) - val fileText = fixture.getFile()!!.getText() + val fileText = FileUtil.loadFile(File(testPath)) val invocationCount = InTextDirectivesUtils.getPrefixedInt(fileText, INVOCATION_COUNT_PREFIX) ?: 1 val lookupString = InTextDirectivesUtils.findStringWithPrefixes(fileText, LOOKUP_STRING_PREFIX) val itemText = InTextDirectivesUtils.findStringWithPrefixes(fileText, ELEMENT_TEXT_PREFIX) @@ -54,6 +56,10 @@ public abstract class AbstractCompletionHandlerTest() : CompletionHandlerTestBas doTestWithTextLoaded(completionType, invocationCount, lookupString, itemText, tailText, completionChar) } + protected open fun setUpFixture(testPath: String) { + fixture.configureByFile(testPath) + } + protected abstract val defaultCompletionType: CompletionType } diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/AbstractEditorForEvaluateExpressionTest.kt b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/AbstractEditorForEvaluateExpressionTest.kt index 1f763385079..35478458571 100644 --- a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/AbstractEditorForEvaluateExpressionTest.kt +++ b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/AbstractEditorForEvaluateExpressionTest.kt @@ -29,6 +29,15 @@ import com.intellij.openapi.application.ApplicationManager import org.jetbrains.jet.lang.resolve.name.FqName import org.jetbrains.jet.InTextDirectivesUtils import org.jetbrains.jet.lang.psi.JetCodeFragment +import org.jetbrains.jet.plugin.caches.resolve.analyzeFully +import org.jetbrains.jet.lang.psi.JetTypeReference +import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.jet.lang.resolve.BindingContext +import org.jetbrains.jet.completion.ExpectedCompletionUtils +import org.jetbrains.jet.lang.psi.JetElement +import org.jetbrains.jet.completion.handlers.AbstractCompletionHandlerTest +import com.intellij.codeInsight.completion.CompletionType +import org.jetbrains.jet.JetTestUtils public abstract class AbstractCodeFragmentHighlightingTest : AbstractJetPsiCheckerTest() { override fun doTest(filePath: String) { @@ -56,12 +65,31 @@ public abstract class AbstractCodeFragmentCompletionTest : AbstractJvmBasicCompl } } +public abstract class AbstractCodeFragmentCompletionHandlerTest : AbstractCompletionHandlerTest() { + override fun setUpFixture(testPath: String) { + myFixture.configureByCodeFragment(testPath) + } + + override val testDataRelativePath: String = "/completion/handlers/runtimeCast/" + override val defaultCompletionType: CompletionType = CompletionType.BASIC +} + private fun JavaCodeInsightTestFixture.configureByCodeFragment(filePath: String) { configureByFile(filePath) val elementAt = getFile()?.findElementAt(getCaretOffset()) val file = createCodeFragment(filePath, elementAt!!) + val typeStr = InTextDirectivesUtils.findStringWithPrefixes(getFile().getText(), "// ${ExpectedCompletionUtils.RUNTIME_TYPE} ") + if (typeStr != null) { + file.putCopyableUserData(JetCodeFragment.RUNTIME_TYPE_EVALUATOR, { + val codeFragment = JetPsiFactory(getProject()).createBlockCodeFragment("val xxx: $typeStr" , PsiTreeUtil.getParentOfType(elementAt, javaClass())) + val context = codeFragment.analyzeFully() + val typeReference: JetTypeReference = PsiTreeUtil.getChildOfType(codeFragment.getContentElement().getFirstChild(), javaClass()) + context[BindingContext.TYPE, typeReference] + }) + } + configureFromExistingVirtualFile(file.getVirtualFile()!!) } diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionHandlerTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionHandlerTestGenerated.java new file mode 100644 index 00000000000..c418cc244e0 --- /dev/null +++ b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionHandlerTestGenerated.java @@ -0,0 +1,56 @@ +/* + * 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.plugin.debugger.evaluate; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.jet.JUnit3RunnerWithInners; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; +import org.jetbrains.jet.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/completion/handlers/runtimeCast") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class CodeFragmentCompletionHandlerTestGenerated extends AbstractCodeFragmentCompletionHandlerTest { + public void testAllFilesPresentInRuntimeCast() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/handlers/runtimeCast"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("CastPrivateFun.kt") + public void testCastPrivateFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/runtimeCast/CastPrivateFun.kt"); + doTest(fileName); + } + + @TestMetadata("InsertExtFunction.kt") + public void testInsertExtFunction() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/runtimeCast/InsertExtFunction.kt"); + doTest(fileName); + } + + @TestMetadata("InsertFunction.kt") + public void testInsertFunction() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/runtimeCast/InsertFunction.kt"); + doTest(fileName); + } +} diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionTestGenerated.java index 89342c594fb..168c21b9f20 100644 --- a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/CodeFragmentCompletionTestGenerated.java @@ -30,6 +30,7 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("idea/testData/completion/basic/codeFragments") @TestDataPath("$PROJECT_ROOT") +@InnerTestClasses({CodeFragmentCompletionTestGenerated.RuntimeType.class}) @RunWith(JUnit3RunnerWithInners.class) public class CodeFragmentCompletionTestGenerated extends AbstractCodeFragmentCompletionTest { public void testAllFilesPresentInCodeFragments() throws Exception { @@ -59,4 +60,37 @@ public class CodeFragmentCompletionTestGenerated extends AbstractCodeFragmentCom String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/topLevel.kt"); doTest(fileName); } + + @TestMetadata("idea/testData/completion/basic/codeFragments/runtimeType") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class RuntimeType extends AbstractCodeFragmentCompletionTest { + public void testAllFilesPresentInRuntimeType() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/basic/codeFragments/runtimeType"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("castWithGenerics.kt") + public void testCastWithGenerics() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/runtimeType/castWithGenerics.kt"); + doTest(fileName); + } + + @TestMetadata("complexHierarchy.kt") + public void testComplexHierarchy() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/runtimeType/complexHierarchy.kt"); + doTest(fileName); + } + + @TestMetadata("extensionMethod.kt") + public void testExtensionMethod() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/runtimeType/extensionMethod.kt"); + doTest(fileName); + } + + @TestMetadata("runtimeCast.kt") + public void testRuntimeCast() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/runtimeType/runtimeCast.kt"); + doTest(fileName); + } + } }