Rewrite 'goto' mpp tests to be generated
Adjust test data Use new util in FindUsagesMultiModuleTest
This commit is contained in:
@@ -642,6 +642,18 @@ fun main(args: Array<String>) {
|
||||
model("multiModuleQuickFix", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractKotlinGotoImplementationMultiModuleTest> {
|
||||
model("navigation/implementations/multiModule", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractKotlinGotoRelatedSymbolMultiModuleTest> {
|
||||
model("navigation/relatedSymbols/multiModule", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractKotlinGotoSuperMultiModuleTest> {
|
||||
model("navigation/gotoSuper/multiModule", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractExtractionTest> {
|
||||
model("refactoring/introduceVariable", pattern = KT_OR_KTS, testMethod = "doIntroduceVariableTest")
|
||||
model("refactoring/extractFunction", pattern = KT_OR_KTS, testMethod = "doExtractFunctionTest")
|
||||
|
||||
@@ -2,4 +2,4 @@ package test
|
||||
|
||||
actual class <caret>Expected
|
||||
|
||||
// REF: [common] (test).Expected
|
||||
// REF: [testModule_Common] (test).Expected
|
||||
|
||||
@@ -6,5 +6,5 @@ actual class Expected {
|
||||
actual val bar = "Hello"
|
||||
}
|
||||
|
||||
// REF: [common] (in test.Expected).foo()
|
||||
// REF: [testModule_Common] (in test.Expected).foo()
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ actual class Expected {
|
||||
actual val <caret>bar = "Hello"
|
||||
}
|
||||
|
||||
// REF: [common] (in test.Expected).bar
|
||||
// REF: [testModule_Common] (in test.Expected).bar
|
||||
|
||||
|
||||
+3
-3
@@ -8,6 +8,6 @@ class ExpectedChildChild : ExpectedChild()
|
||||
|
||||
class SimpleChild : SimpleParent()
|
||||
|
||||
// REF: [common] (test).ExpectedChildChild
|
||||
// REF: [jvm] (test).ExpectedChild
|
||||
// REF: [jvm] (test).ExpectedChildChildJvm
|
||||
// REF: [testModule_Common] (test).ExpectedChildChild
|
||||
// REF: [testModule_JVM] (test).ExpectedChild
|
||||
// REF: [testModule_JVM] (test).ExpectedChildChildJvm
|
||||
+3
-3
@@ -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)
|
||||
// REF: [testModule_Common] (in test.ExpectedChildChild).foo(Int)
|
||||
// REF: [testModule_JVM] (in test.ExpectedChild).foo(Int)
|
||||
// REF: [testModule_JVM] (in test.ExpectedChildChildJvm).foo(Int)
|
||||
+3
-3
@@ -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
|
||||
// REF: [testModule_Common] (in test.ExpectedChildChild).bar
|
||||
// REF: [testModule_JVM] (in test.ExpectedChild).bar
|
||||
// REF: [testModule_JVM] (in test.ExpectedChildChildJvm).bar
|
||||
Vendored
+5
-5
@@ -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
|
||||
// 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
|
||||
Vendored
+5
-5
@@ -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)
|
||||
// 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)
|
||||
Vendored
+5
-5
@@ -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
|
||||
// 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
|
||||
+2
-2
@@ -4,5 +4,5 @@ interface I {
|
||||
suspend fun <caret>foo(s: String)
|
||||
}
|
||||
|
||||
// REF: [js] (in test.C).foo(String)
|
||||
// REF: [jvm] (in test.C).foo(String)
|
||||
// REF: [testModule_JS] (in test.C).foo(String)
|
||||
// REF: [testModule_JVM] (in test.C).foo(String)
|
||||
+1
-1
@@ -4,4 +4,4 @@ actual class Foo {
|
||||
actual fun <caret>bar() {}
|
||||
}
|
||||
|
||||
// REF: [common] (in test.Foo).bar()
|
||||
// REF: [testModule_Common] (in test.Foo).bar()
|
||||
+1
-1
@@ -4,4 +4,4 @@ actual class Foo {
|
||||
actual val <caret>bar: Int get() = 1
|
||||
}
|
||||
|
||||
// REF: [common] (in test.Foo).bar
|
||||
// REF: [testModule_Common] (in test.Foo).bar
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ expect class Foo {
|
||||
fun <caret>bar()
|
||||
}
|
||||
|
||||
// REF: [jvm] (in test.Foo).bar()
|
||||
// REF: [js] (in test.Foo).bar()
|
||||
// REF: [testModule_JVM] (in test.Foo).bar()
|
||||
// REF: [testModule_JS] (in test.Foo).bar()
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ expect class Foo {
|
||||
val <caret>bar: Int
|
||||
}
|
||||
|
||||
// REF: [jvm] (in test.Foo).bar
|
||||
// REF: [js] (in test.Foo).bar
|
||||
// REF: [testModule_JVM] (in test.Foo).bar
|
||||
// REF: [testModule_JS] (in test.Foo).bar
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ actual class Foo {
|
||||
actual class <caret>Bar
|
||||
}
|
||||
|
||||
// REF: [common] (in test.Foo).Bar
|
||||
// REF: [testModule_Common] (in test.Foo).Bar
|
||||
Vendored
+2
-2
@@ -4,5 +4,5 @@ expect class Foo {
|
||||
class <caret>Bar
|
||||
}
|
||||
|
||||
// REF: [js] (in test.Foo).Bar
|
||||
// REF: [jvm] (in test.Foo).Bar
|
||||
// REF: [testModule_JS] (in test.Foo).Bar
|
||||
// REF: [testModule_JVM] (in test.Foo).Bar
|
||||
Vendored
+1
-1
@@ -2,4 +2,4 @@ package test
|
||||
|
||||
actual class <caret>Foo
|
||||
|
||||
// REF: [common] (test).Foo
|
||||
// REF: [testModule_Common] (test).Foo
|
||||
Vendored
+1
-1
@@ -2,4 +2,4 @@ package test
|
||||
|
||||
actual fun <caret>foo() {}
|
||||
|
||||
// REF: [common] (test).foo()
|
||||
// REF: [testModule_Common] (test).foo()
|
||||
Vendored
+1
-1
@@ -2,4 +2,4 @@ package test
|
||||
|
||||
actual val <caret>foo: Int get() = 1
|
||||
|
||||
// REF: [common] (test).foo
|
||||
// REF: [testModule_Common] (test).foo
|
||||
+2
-2
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
expect class <caret>Foo
|
||||
|
||||
// REF: [jvm] (test).Foo
|
||||
// REF: [js] (test).Foo
|
||||
// REF: [testModule_JVM] (test).Foo
|
||||
// REF: [testModule_JS] (test).Foo
|
||||
Vendored
+2
-2
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
expect fun <caret>foo()
|
||||
|
||||
// REF: [jvm] (test).foo()
|
||||
// REF: [js] (test).foo()
|
||||
// REF: [testModule_JVM] (test).foo()
|
||||
// REF: [testModule_JS] (test).foo()
|
||||
Vendored
+2
-2
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
expect val <caret>foo: Int
|
||||
|
||||
// REF: [jvm] (test).foo
|
||||
// REF: [js] (test).foo
|
||||
// REF: [testModule_JVM] (test).foo
|
||||
// REF: [testModule_JS] (test).foo
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
+40
-27
@@ -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<String, TargetPlatformKind<*>> = 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, "<caret>")
|
||||
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 { "<caret>" 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())
|
||||
}
|
||||
}
|
||||
-63
@@ -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")
|
||||
}
|
||||
}
|
||||
+69
@@ -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);
|
||||
}
|
||||
}
|
||||
-83
@@ -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")
|
||||
}
|
||||
}
|
||||
idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoRelatedSymbolMultiModuleTestGenerated.java
Generated
+99
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
Generated
+45
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user