diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index d883cfdc046..57631693526 100755 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -642,6 +642,18 @@ fun main(args: Array) { model("multiModuleQuickFix", recursive = false, extension = null) } + testClass { + model("navigation/implementations/multiModule", recursive = false, extension = null) + } + + testClass { + model("navigation/relatedSymbols/multiModule", recursive = false, extension = null) + } + + testClass { + model("navigation/gotoSuper/multiModule", recursive = false, extension = null) + } + testClass { model("refactoring/introduceVariable", pattern = KT_OR_KTS, testMethod = "doIntroduceVariableTest") model("refactoring/extractFunction", pattern = KT_OR_KTS, testMethod = "doExtractFunctionTest") diff --git a/idea/testData/navigation/gotoSuper/multiModule/actualClass/jvm/jvm.kt b/idea/testData/navigation/gotoSuper/multiModule/actualClass/jvm/jvm.kt index d37f8494bee..33ac3d09fe8 100644 --- a/idea/testData/navigation/gotoSuper/multiModule/actualClass/jvm/jvm.kt +++ b/idea/testData/navigation/gotoSuper/multiModule/actualClass/jvm/jvm.kt @@ -2,4 +2,4 @@ package test actual class Expected -// REF: [common] (test).Expected +// REF: [testModule_Common] (test).Expected diff --git a/idea/testData/navigation/gotoSuper/multiModule/actualFunction/jvm/jvm.kt b/idea/testData/navigation/gotoSuper/multiModule/actualFunction/jvm/jvm.kt index a0d99674b8e..4fde86e0816 100644 --- a/idea/testData/navigation/gotoSuper/multiModule/actualFunction/jvm/jvm.kt +++ b/idea/testData/navigation/gotoSuper/multiModule/actualFunction/jvm/jvm.kt @@ -6,5 +6,5 @@ actual class Expected { actual val bar = "Hello" } -// REF: [common] (in test.Expected).foo() +// REF: [testModule_Common] (in test.Expected).foo() diff --git a/idea/testData/navigation/gotoSuper/multiModule/actualProperty/jvm/jvm.kt b/idea/testData/navigation/gotoSuper/multiModule/actualProperty/jvm/jvm.kt index 672fc471e0d..394f2a19571 100644 --- a/idea/testData/navigation/gotoSuper/multiModule/actualProperty/jvm/jvm.kt +++ b/idea/testData/navigation/gotoSuper/multiModule/actualProperty/jvm/jvm.kt @@ -6,5 +6,5 @@ actual class Expected { actual val bar = "Hello" } -// REF: [common] (in test.Expected).bar +// REF: [testModule_Common] (in test.Expected).bar diff --git a/idea/testData/navigation/implementations/multiModule/expectClass/common/common.kt b/idea/testData/navigation/implementations/multiModule/expectClass/common/common.kt index 3356db5a908..f9b33cd4be5 100644 --- a/idea/testData/navigation/implementations/multiModule/expectClass/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/expectClass/common/common.kt @@ -8,6 +8,6 @@ class ExpectedChildChild : ExpectedChild() class SimpleChild : SimpleParent() -// REF: [common] (test).ExpectedChildChild -// REF: [jvm] (test).ExpectedChild -// REF: [jvm] (test).ExpectedChildChildJvm \ No newline at end of file +// REF: [testModule_Common] (test).ExpectedChildChild +// REF: [testModule_JVM] (test).ExpectedChild +// REF: [testModule_JVM] (test).ExpectedChildChildJvm \ No newline at end of file diff --git a/idea/testData/navigation/implementations/multiModule/expectClassFun/common/common.kt b/idea/testData/navigation/implementations/multiModule/expectClassFun/common/common.kt index 3a27847e0b8..d0352926f21 100644 --- a/idea/testData/navigation/implementations/multiModule/expectClassFun/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/expectClassFun/common/common.kt @@ -16,6 +16,6 @@ class SimpleChild : SimpleParent() { override fun foo(n: Int) {} } -// REF: [common] (in test.ExpectedChildChild).foo(Int) -// REF: [jvm] (in test.ExpectedChild).foo(Int) -// REF: [jvm] (in test.ExpectedChildChildJvm).foo(Int) \ No newline at end of file +// REF: [testModule_Common] (in test.ExpectedChildChild).foo(Int) +// REF: [testModule_JVM] (in test.ExpectedChild).foo(Int) +// REF: [testModule_JVM] (in test.ExpectedChildChildJvm).foo(Int) \ No newline at end of file diff --git a/idea/testData/navigation/implementations/multiModule/expectClassProperty/common/common.kt b/idea/testData/navigation/implementations/multiModule/expectClassProperty/common/common.kt index ec02dde4221..f13dd883b74 100644 --- a/idea/testData/navigation/implementations/multiModule/expectClassProperty/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/expectClassProperty/common/common.kt @@ -16,6 +16,6 @@ class SimpleChild : SimpleParent() { override val bar: Int get() = 1 } -// REF: [common] (in test.ExpectedChildChild).bar -// REF: [jvm] (in test.ExpectedChild).bar -// REF: [jvm] (in test.ExpectedChildChildJvm).bar \ No newline at end of file +// REF: [testModule_Common] (in test.ExpectedChildChild).bar +// REF: [testModule_JVM] (in test.ExpectedChild).bar +// REF: [testModule_JVM] (in test.ExpectedChildChildJvm).bar \ No newline at end of file diff --git a/idea/testData/navigation/implementations/multiModule/expectClassSuperclass/common/common.kt b/idea/testData/navigation/implementations/multiModule/expectClassSuperclass/common/common.kt index 944f6e6b8ee..d010e3b6771 100644 --- a/idea/testData/navigation/implementations/multiModule/expectClassSuperclass/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/expectClassSuperclass/common/common.kt @@ -8,8 +8,8 @@ class ExpectedChildChild : ExpectedChild() class SimpleChild : SimpleParent() -// REF: [common] (test).ExpectedChild -// REF: [common] (test).ExpectedChildChild -// REF: [common] (test).SimpleChild -// REF: [jvm] (test).ExpectedChild -// REF: [jvm] (test).ExpectedChildChildJvm \ No newline at end of file +// REF: [testModule_Common] (test).ExpectedChild +// REF: [testModule_Common] (test).ExpectedChildChild +// REF: [testModule_Common] (test).SimpleChild +// REF: [testModule_JVM] (test).ExpectedChild +// REF: [testModule_JVM] (test).ExpectedChildChildJvm \ No newline at end of file diff --git a/idea/testData/navigation/implementations/multiModule/expectClassSuperclassFun/common/common.kt b/idea/testData/navigation/implementations/multiModule/expectClassSuperclassFun/common/common.kt index 6c5d4eca256..c8d4a01ce24 100644 --- a/idea/testData/navigation/implementations/multiModule/expectClassSuperclassFun/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/expectClassSuperclassFun/common/common.kt @@ -16,8 +16,8 @@ class SimpleChild : SimpleParent() { override fun foo(n: Int) {} } -// REF: [common] (in test.ExpectedChild).foo(Int) -// REF: [common] (in test.ExpectedChildChild).foo(Int) -// REF: [common] (in test.SimpleChild).foo(Int) -// REF: [jvm] (in test.ExpectedChild).foo(Int) -// REF: [jvm] (in test.ExpectedChildChildJvm).foo(Int) \ No newline at end of file +// REF: [testModule_Common] (in test.ExpectedChild).foo(Int) +// REF: [testModule_Common] (in test.ExpectedChildChild).foo(Int) +// REF: [testModule_Common] (in test.SimpleChild).foo(Int) +// REF: [testModule_JVM] (in test.ExpectedChild).foo(Int) +// REF: [testModule_JVM] (in test.ExpectedChildChildJvm).foo(Int) \ No newline at end of file diff --git a/idea/testData/navigation/implementations/multiModule/expectClassSuperclassProperty/common/common.kt b/idea/testData/navigation/implementations/multiModule/expectClassSuperclassProperty/common/common.kt index f7bce1da0eb..dca562673a9 100644 --- a/idea/testData/navigation/implementations/multiModule/expectClassSuperclassProperty/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/expectClassSuperclassProperty/common/common.kt @@ -16,8 +16,8 @@ class SimpleChild : SimpleParent() { override val bar: Int get() = 1 } -// REF: [common] (in test.ExpectedChild).bar -// REF: [common] (in test.ExpectedChildChild).bar -// REF: [common] (in test.SimpleChild).bar -// REF: [jvm] (in test.ExpectedChild).bar -// REF: [jvm] (in test.ExpectedChildChildJvm).bar \ No newline at end of file +// REF: [testModule_Common] (in test.ExpectedChild).bar +// REF: [testModule_Common] (in test.ExpectedChildChild).bar +// REF: [testModule_Common] (in test.SimpleChild).bar +// REF: [testModule_JVM] (in test.ExpectedChild).bar +// REF: [testModule_JVM] (in test.ExpectedChildChildJvm).bar \ No newline at end of file diff --git a/idea/testData/navigation/implementations/multiModule/suspendFunImpl/common/common.kt b/idea/testData/navigation/implementations/multiModule/suspendFunImpl/common/common.kt index 5386c8a8bc4..0d9d2bf5d81 100644 --- a/idea/testData/navigation/implementations/multiModule/suspendFunImpl/common/common.kt +++ b/idea/testData/navigation/implementations/multiModule/suspendFunImpl/common/common.kt @@ -4,5 +4,5 @@ interface I { suspend fun foo(s: String) } -// REF: [js] (in test.C).foo(String) -// REF: [jvm] (in test.C).foo(String) \ No newline at end of file +// REF: [testModule_JS] (in test.C).foo(String) +// REF: [testModule_JVM] (in test.C).foo(String) \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberFunToExpect/jvm/jvm.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberFunToExpect/jvm/jvm.kt index 88669806136..f2bb50e4e90 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberFunToExpect/jvm/jvm.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberFunToExpect/jvm/jvm.kt @@ -4,4 +4,4 @@ actual class Foo { actual fun bar() {} } -// REF: [common] (in test.Foo).bar() \ No newline at end of file +// REF: [testModule_Common] (in test.Foo).bar() \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberValToExpect/jvm/jvm.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberValToExpect/jvm/jvm.kt index 6f18cb3a76c..094f5dcd7c4 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberValToExpect/jvm/jvm.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberValToExpect/jvm/jvm.kt @@ -4,4 +4,4 @@ actual class Foo { actual val bar: Int get() = 1 } -// REF: [common] (in test.Foo).bar \ No newline at end of file +// REF: [testModule_Common] (in test.Foo).bar \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberFunToActuals/common/common.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberFunToActuals/common/common.kt index 639addb9ed0..6f03737ca0b 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberFunToActuals/common/common.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberFunToActuals/common/common.kt @@ -4,5 +4,5 @@ expect class Foo { fun bar() } -// REF: [jvm] (in test.Foo).bar() -// REF: [js] (in test.Foo).bar() \ No newline at end of file +// REF: [testModule_JVM] (in test.Foo).bar() +// REF: [testModule_JS] (in test.Foo).bar() \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberValToActuals/common/common.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberValToActuals/common/common.kt index 923d78d3080..c68652bd73a 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberValToActuals/common/common.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberValToActuals/common/common.kt @@ -4,5 +4,5 @@ expect class Foo { val bar: Int } -// REF: [jvm] (in test.Foo).bar -// REF: [js] (in test.Foo).bar \ No newline at end of file +// REF: [testModule_JVM] (in test.Foo).bar +// REF: [testModule_JS] (in test.Foo).bar \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromNestedActualClassToExpect/jvm/jvm.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromNestedActualClassToExpect/jvm/jvm.kt index ece0eeb7153..4e0e1ff9da3 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromNestedActualClassToExpect/jvm/jvm.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromNestedActualClassToExpect/jvm/jvm.kt @@ -4,4 +4,4 @@ actual class Foo { actual class Bar } -// REF: [common] (in test.Foo).Bar \ No newline at end of file +// REF: [testModule_Common] (in test.Foo).Bar \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromNestedExpectClassToActuals/common/common.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromNestedExpectClassToActuals/common/common.kt index b2ec1ef2ff8..da987fd2b2d 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromNestedExpectClassToActuals/common/common.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromNestedExpectClassToActuals/common/common.kt @@ -4,5 +4,5 @@ expect class Foo { class Bar } -// REF: [js] (in test.Foo).Bar -// REF: [jvm] (in test.Foo).Bar \ No newline at end of file +// REF: [testModule_JS] (in test.Foo).Bar +// REF: [testModule_JVM] (in test.Foo).Bar \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualClassToExpect/jvm/jvm.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualClassToExpect/jvm/jvm.kt index e19d004bac7..081540ba317 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualClassToExpect/jvm/jvm.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualClassToExpect/jvm/jvm.kt @@ -2,4 +2,4 @@ package test actual class Foo -// REF: [common] (test).Foo \ No newline at end of file +// REF: [testModule_Common] (test).Foo \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualFunToExpect/jvm/jvm.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualFunToExpect/jvm/jvm.kt index f9a88dede20..2c75b361ad0 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualFunToExpect/jvm/jvm.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualFunToExpect/jvm/jvm.kt @@ -2,4 +2,4 @@ package test actual fun foo() {} -// REF: [common] (test).foo() \ No newline at end of file +// REF: [testModule_Common] (test).foo() \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualValToExpect/jvm/jvm.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualValToExpect/jvm/jvm.kt index bfdd681e2f9..bf25107dce1 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualValToExpect/jvm/jvm.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualValToExpect/jvm/jvm.kt @@ -2,4 +2,4 @@ package test actual val foo: Int get() = 1 -// REF: [common] (test).foo \ No newline at end of file +// REF: [testModule_Common] (test).foo \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectClassToActuals/common/common.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectClassToActuals/common/common.kt index f5af7f5b866..ebc99808426 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectClassToActuals/common/common.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectClassToActuals/common/common.kt @@ -2,5 +2,5 @@ package test expect class Foo -// REF: [jvm] (test).Foo -// REF: [js] (test).Foo \ No newline at end of file +// REF: [testModule_JVM] (test).Foo +// REF: [testModule_JS] (test).Foo \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectFunToActuals/common/common.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectFunToActuals/common/common.kt index 610d0aa2166..82b9954fdda 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectFunToActuals/common/common.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectFunToActuals/common/common.kt @@ -2,5 +2,5 @@ package test expect fun foo() -// REF: [jvm] (test).foo() -// REF: [js] (test).foo() \ No newline at end of file +// REF: [testModule_JVM] (test).foo() +// REF: [testModule_JS] (test).foo() \ No newline at end of file diff --git a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectValToActuals/common/common.kt b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectValToActuals/common/common.kt index 6ea8c3baa02..0d201b501f5 100644 --- a/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectValToActuals/common/common.kt +++ b/idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectValToActuals/common/common.kt @@ -2,5 +2,5 @@ package test expect val foo: Int -// REF: [jvm] (test).foo -// REF: [js] (test).foo \ No newline at end of file +// REF: [testModule_JVM] (test).foo +// REF: [testModule_JS] (test).foo \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleTest.kt b/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleTest.kt index 3e9fcaeed04..3766599baba 100644 --- a/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleTest.kt +++ b/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesMultiModuleTest.kt @@ -16,29 +16,19 @@ package org.jetbrains.kotlin.findUsages -import org.jetbrains.kotlin.config.JvmTarget -import org.jetbrains.kotlin.config.TargetPlatformKind -import org.jetbrains.kotlin.idea.stubs.createFacet +import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromDirStructure import org.junit.Test +import java.io.File class FindUsagesMultiModuleTest : AbstractFindUsagesMultiModuleTest() { - private fun doMultiPlatformTest(commonName: String = "common", - implName: String = "jvm", - implKind: TargetPlatformKind<*> = TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) { - val commonModule = module(commonName) - commonModule.createFacet(TargetPlatformKind.Common, false) - - val jvm = module(implName) - jvm.createFacet(implKind) - jvm.enableMultiPlatform() - jvm.addDependency(commonModule) - - doFindUsagesTest() - } - @Test fun testFindImplFromHeader() { - doMultiPlatformTest() + doTest() + } + + private fun doTest() { + setupMppProjectFromDirStructure(File(testDataPath + getTestName(true).removePrefix("test"))) + doFindUsagesTest() } } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinNavigationMultiModuleTest.kt b/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinNavigationMultiModuleTest.kt index 49277584ea5..01ff7408b8f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinNavigationMultiModuleTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinNavigationMultiModuleTest.kt @@ -6,36 +6,26 @@ package org.jetbrains.kotlin.idea.navigation import com.intellij.codeInsight.navigation.GotoTargetHandler +import com.intellij.codeInsight.navigation.NavigationUtil import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.EditorFactory +import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.config.JvmTarget -import org.jetbrains.kotlin.config.TargetPlatformKind +import org.jetbrains.kotlin.idea.codeInsight.GotoSuperActionHandler +import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromDirStructure import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest -import org.jetbrains.kotlin.idea.stubs.createFacet +import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.idea.test.allKotlinFiles import org.jetbrains.kotlin.idea.test.extractMarkerOffset +import java.io.File abstract class AbstractKotlinNavigationMultiModuleTest : AbstractMultiModuleTest() { protected abstract fun doNavigate(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData - protected fun doMultiPlatformTest( - testFileName: String, - commonModuleName: String = "common", - vararg actuals: Pair> = arrayOf("jvm" to TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - ) { - val commonModule = module(commonModuleName) - commonModule.createFacet(TargetPlatformKind.Common, false) - - actuals.forEach { (actualName, actualKind) -> - val implModule = module(actualName) - implModule.createFacet(actualKind, implementedModuleName = commonModuleName) - implModule.enableMultiPlatform() - implModule.addDependency(commonModule) - } - - val file = project.allKotlinFiles().single { it.name == testFileName } + protected fun doTest(testDataDir: String) { + setupMppProjectFromDirStructure(File(testDataDir)) + val file = findFileWithCaret() val doc = PsiDocumentManager.getInstance(myProject).getDocument(file)!! val offset = doc.extractMarkerOffset(project, "") val editor = EditorFactory.getInstance().createEditor(doc, myProject) @@ -43,17 +33,40 @@ abstract class AbstractKotlinNavigationMultiModuleTest : AbstractMultiModuleTest try { val gotoData = doNavigate(editor, file) NavigationTestUtils.assertGotoDataMatching(editor, gotoData, true) - } - finally { + } finally { EditorFactory.getInstance().releaseEditor(editor) } } - protected fun doMultiPlatformTestJvmJs(testFileName: String, commonModuleName: String = "common") { - doMultiPlatformTest( - testFileName, - commonModuleName, - *arrayOf("jvm" to TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], "js" to TargetPlatformKind.JavaScript) - ) + private fun findFileWithCaret() = + project.allKotlinFiles().single { "" in VfsUtilCore.loadText(it.virtualFile) } +} + + +abstract class AbstractKotlinGotoImplementationMultiModuleTest : AbstractKotlinNavigationMultiModuleTest() { + override fun getTestDataPath() = + File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/implementations/multiModule").path + File.separator + + override fun doNavigate(editor: Editor, file: PsiFile) = NavigationTestUtils.invokeGotoImplementations(editor, file)!! +} + +abstract class AbstractKotlinGotoSuperMultiModuleTest : AbstractKotlinNavigationMultiModuleTest() { + override fun getTestDataPath() = + File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/gotoSuper/multiModule").path + File.separator + + override fun doNavigate(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData { + val (superDeclarations, _) = GotoSuperActionHandler.SuperDeclarationsAndDescriptor.forDeclarationAtCaret(editor, file) + return GotoTargetHandler.GotoData(file.findElementAt(editor.caretModel.offset)!!, superDeclarations.toTypedArray(), emptyList()) + } +} + +abstract class AbstractKotlinGotoRelatedSymbolMultiModuleTest : AbstractKotlinNavigationMultiModuleTest() { + override fun getTestDataPath() = + File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/relatedSymbols/multiModule").path + File.separator + + override fun doNavigate(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData { + val source = file.findElementAt(editor.caretModel.offset)!! + val relatedItems = NavigationUtil.collectRelatedItems(source, null) + return GotoTargetHandler.GotoData(source, relatedItems.map { it.element }.toTypedArray(), emptyList()) } } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationMultiModuleTest.kt b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationMultiModuleTest.kt deleted file mode 100644 index ca20c52b516..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationMultiModuleTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2010-2017 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.kotlin.idea.navigation - -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.config.JvmTarget -import org.jetbrains.kotlin.config.TargetPlatformKind -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import java.io.File - -class KotlinGotoImplementationMultiModuleTest : AbstractKotlinNavigationMultiModuleTest() { - override fun getTestDataPath(): String { - return File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/implementations/multiModule").path + File.separator - } - - override fun doNavigate(editor: Editor, file: PsiFile) = NavigationTestUtils.invokeGotoImplementations(editor, file) - - fun testSuspendFunImpl() { - doMultiPlatformTest( - "common.kt", - actuals = *arrayOf("jvm" to TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], "js" to TargetPlatformKind.JavaScript) - ) - } - - fun testExpectClassSuperclass() { - doMultiPlatformTest("common.kt") - } - - fun testExpectClassSuperclassFun() { - doMultiPlatformTest("common.kt") - } - - fun testExpectClassSuperclassProperty() { - doMultiPlatformTest("common.kt") - } - - fun testExpectClass() { - doMultiPlatformTest("common.kt") - } - - fun testExpectClassFun() { - doMultiPlatformTest("common.kt") - } - - fun testExpectClassProperty() { - doMultiPlatformTest("common.kt") - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationMultiModuleTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationMultiModuleTestGenerated.java new file mode 100644 index 00000000000..56bac805575 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationMultiModuleTestGenerated.java @@ -0,0 +1,69 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.navigation; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/navigation/implementations/multiModule") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class KotlinGotoImplementationMultiModuleTestGenerated extends AbstractKotlinGotoImplementationMultiModuleTest { + public void testAllFilesPresentInMultiModule() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/navigation/implementations/multiModule"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false); + } + + @TestMetadata("expectClass") + public void testExpectClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/expectClass/"); + doTest(fileName); + } + + @TestMetadata("expectClassFun") + public void testExpectClassFun() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/expectClassFun/"); + doTest(fileName); + } + + @TestMetadata("expectClassProperty") + public void testExpectClassProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/expectClassProperty/"); + doTest(fileName); + } + + @TestMetadata("expectClassSuperclass") + public void testExpectClassSuperclass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/expectClassSuperclass/"); + doTest(fileName); + } + + @TestMetadata("expectClassSuperclassFun") + public void testExpectClassSuperclassFun() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/expectClassSuperclassFun/"); + doTest(fileName); + } + + @TestMetadata("expectClassSuperclassProperty") + public void testExpectClassSuperclassProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/expectClassSuperclassProperty/"); + doTest(fileName); + } + + @TestMetadata("suspendFunImpl") + public void testSuspendFunImpl() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/implementations/multiModule/suspendFunImpl/"); + doTest(fileName); + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTest.kt b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTest.kt deleted file mode 100644 index 01ca6a6aee1..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTest.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2010-2017 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.kotlin.idea.navigation - -import com.intellij.codeInsight.navigation.GotoTargetHandler -import com.intellij.codeInsight.navigation.NavigationUtil -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import java.io.File - -class KotlinGotoRelatedSymbolMultiModuleTest : AbstractKotlinNavigationMultiModuleTest() { - override fun getTestDataPath() = - File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/relatedSymbols/multiModule").path + File.separator - - override fun doNavigate(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData { - val source = file.findElementAt(editor.caretModel.offset)!! - val relatedItems = NavigationUtil.collectRelatedItems(source, null) - return GotoTargetHandler.GotoData(source, relatedItems.map { it.element }.toTypedArray(), emptyList()) - } - - fun testFromTopLevelExpectClassToActuals() { - doMultiPlatformTestJvmJs("common.kt") - } - - fun testFromTopLevelActualClassToExpect() { - doMultiPlatformTestJvmJs("jvm.kt") - } - - fun testFromTopLevelExpectFunToActuals() { - doMultiPlatformTestJvmJs("common.kt") - } - - fun testFromTopLevelActualFunToExpect() { - doMultiPlatformTestJvmJs("jvm.kt") - } - - fun testFromTopLevelExpectValToActuals() { - doMultiPlatformTestJvmJs("common.kt") - } - - fun testFromTopLevelActualValToExpect() { - doMultiPlatformTestJvmJs("jvm.kt") - } - - fun testFromNestedExpectClassToActuals() { - doMultiPlatformTestJvmJs("common.kt") - } - - fun testFromNestedActualClassToExpect() { - doMultiPlatformTestJvmJs("jvm.kt") - } - - fun testFromExpectMemberFunToActuals() { - doMultiPlatformTestJvmJs("common.kt") - } - - fun testFromActualMemberFunToExpect() { - doMultiPlatformTestJvmJs("jvm.kt") - } - - fun testFromExpectMemberValToActuals() { - doMultiPlatformTestJvmJs("common.kt") - } - - fun testFromActualMemberValToExpect() { - doMultiPlatformTestJvmJs("jvm.kt") - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTestGenerated.java new file mode 100644 index 00000000000..957638c2d96 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTestGenerated.java @@ -0,0 +1,99 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.navigation; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/navigation/relatedSymbols/multiModule") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class KotlinGotoRelatedSymbolMultiModuleTestGenerated extends AbstractKotlinGotoRelatedSymbolMultiModuleTest { + public void testAllFilesPresentInMultiModule() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/navigation/relatedSymbols/multiModule"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false); + } + + @TestMetadata("fromActualMemberFunToExpect") + public void testFromActualMemberFunToExpect() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberFunToExpect/"); + doTest(fileName); + } + + @TestMetadata("fromActualMemberValToExpect") + public void testFromActualMemberValToExpect() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromActualMemberValToExpect/"); + doTest(fileName); + } + + @TestMetadata("fromExpectMemberFunToActuals") + public void testFromExpectMemberFunToActuals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberFunToActuals/"); + doTest(fileName); + } + + @TestMetadata("fromExpectMemberValToActuals") + public void testFromExpectMemberValToActuals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromExpectMemberValToActuals/"); + doTest(fileName); + } + + @TestMetadata("fromNestedActualClassToExpect") + public void testFromNestedActualClassToExpect() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromNestedActualClassToExpect/"); + doTest(fileName); + } + + @TestMetadata("fromNestedExpectClassToActuals") + public void testFromNestedExpectClassToActuals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromNestedExpectClassToActuals/"); + doTest(fileName); + } + + @TestMetadata("fromTopLevelActualClassToExpect") + public void testFromTopLevelActualClassToExpect() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualClassToExpect/"); + doTest(fileName); + } + + @TestMetadata("fromTopLevelActualFunToExpect") + public void testFromTopLevelActualFunToExpect() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualFunToExpect/"); + doTest(fileName); + } + + @TestMetadata("fromTopLevelActualValToExpect") + public void testFromTopLevelActualValToExpect() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelActualValToExpect/"); + doTest(fileName); + } + + @TestMetadata("fromTopLevelExpectClassToActuals") + public void testFromTopLevelExpectClassToActuals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectClassToActuals/"); + doTest(fileName); + } + + @TestMetadata("fromTopLevelExpectFunToActuals") + public void testFromTopLevelExpectFunToActuals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectFunToActuals/"); + doTest(fileName); + } + + @TestMetadata("fromTopLevelExpectValToActuals") + public void testFromTopLevelExpectValToActuals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/relatedSymbols/multiModule/fromTopLevelExpectValToActuals/"); + doTest(fileName); + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoSuperMultiModuleTest.kt b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoSuperMultiModuleTest.kt deleted file mode 100644 index bd4006d4d16..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoSuperMultiModuleTest.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.navigation - -import com.intellij.codeInsight.navigation.GotoTargetHandler -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.idea.codeInsight.GotoSuperActionHandler -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import java.io.File - -class KotlinGotoSuperMultiModuleTest : AbstractKotlinNavigationMultiModuleTest() { - override fun doNavigate(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData { - val (superDeclarations, _) = GotoSuperActionHandler.SuperDeclarationsAndDescriptor.forDeclarationAtCaret(editor, file) - return GotoTargetHandler.GotoData(file.findElementAt(editor.caretModel.offset)!!, superDeclarations.toTypedArray(), emptyList()) - } - - override fun getTestDataPath() = - File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/gotoSuper/multiModule").path + File.separator - - fun testActualClass() { - doMultiPlatformTest("jvm.kt") - } - - fun testActualFunction() { - doMultiPlatformTest("jvm.kt") - } - - fun testActualProperty() { - doMultiPlatformTest("jvm.kt") - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoSuperMultiModuleTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoSuperMultiModuleTestGenerated.java new file mode 100644 index 00000000000..bf87b31a6f0 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoSuperMultiModuleTestGenerated.java @@ -0,0 +1,45 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.navigation; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/navigation/gotoSuper/multiModule") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class KotlinGotoSuperMultiModuleTestGenerated extends AbstractKotlinGotoSuperMultiModuleTest { + @TestMetadata("actualClass") + public void testActualClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/gotoSuper/multiModule/actualClass/"); + doTest(fileName); + } + + @TestMetadata("actualFunction") + public void testActualFunction() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/gotoSuper/multiModule/actualFunction/"); + doTest(fileName); + } + + @TestMetadata("actualProperty") + public void testActualProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/gotoSuper/multiModule/actualProperty/"); + doTest(fileName); + } + + public void testAllFilesPresentInMultiModule() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/navigation/gotoSuper/multiModule"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false); + } +}