diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleHighlightingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleHighlightingTest.kt index b35aabba8f5..67915b09c7d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleHighlightingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleHighlightingTest.kt @@ -16,6 +16,9 @@ package org.jetbrains.kotlin.idea.caches.resolve +import com.intellij.openapi.module.Module +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime +import org.jetbrains.kotlin.config.TargetPlatformKind import org.jetbrains.kotlin.idea.project.PluginJetFilesProvider import org.jetbrains.kotlin.idea.stubs.AbstractMultiHighlightingTest import org.jetbrains.kotlin.idea.test.PluginTestCaseBase @@ -25,6 +28,34 @@ abstract class AbstractMultiModuleHighlightingTest : AbstractMultiHighlightingTe override val testPath = PluginTestCaseBase.getTestDataPathBase() + "/multiModuleHighlighting/" + protected fun doMultiPlatformTest( + vararg platforms: TargetPlatformKind<*>, + withStdlibCommon: Boolean = false, + configureModule: (Module, TargetPlatformKind<*>) -> Unit = { _, _ -> }, + useFullJdk: Boolean = false + ) { + val commonModule = module("common", useFullJdk = useFullJdk) + commonModule.createFacet(TargetPlatformKind.Common) + if (withStdlibCommon) { + commonModule.addLibrary(ForTestCompileRuntime.stdlibCommonForTests()) + } + + for (platform in platforms) { + val path = when (platform) { + is TargetPlatformKind.Jvm -> "jvm" + is TargetPlatformKind.JavaScript -> "js" + else -> error("Unsupported platform: $platform") + } + val platformModule = module(path, useFullJdk = useFullJdk) + platformModule.createFacet(platform) + platformModule.enableMultiPlatform() + platformModule.addDependency(commonModule) + configureModule(platformModule, platform) + } + + checkHighlightingInAllFiles() + } + protected fun checkHighlightingInAllFiles() { var atLeastOneFile = false PluginJetFilesProvider.allFilesInProject(myProject!!).forEach { file -> diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt index 3df79661dd8..9f614753ec4 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.idea.caches.resolve -import com.intellij.openapi.module.Module import com.intellij.openapi.roots.DependencyScope import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime import org.jetbrains.kotlin.config.JvmTarget @@ -66,65 +65,37 @@ class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() { class MultiPlatform : AbstractMultiModuleHighlightingTest() { override val testPath get() = super.testPath + "multiplatform/" - private fun doTest( - vararg platforms: TargetPlatformKind<*>, - withStdlibCommon: Boolean = false, - configureModule: (Module, TargetPlatformKind<*>) -> Unit = { _, _ -> }, - useFullJdk: Boolean = false - ) { - val commonModule = module("common", useFullJdk = useFullJdk) - commonModule.createFacet(TargetPlatformKind.Common) - if (withStdlibCommon) { - commonModule.addLibrary(ForTestCompileRuntime.stdlibCommonForTests()) - } - - for (platform in platforms) { - val path = when (platform) { - is TargetPlatformKind.Jvm -> "jvm" - is TargetPlatformKind.JavaScript -> "js" - else -> error("Unsupported platform: $platform") - } - val platformModule = module(path, useFullJdk = useFullJdk) - platformModule.createFacet(platform) - platformModule.enableMultiPlatform() - platformModule.addDependency(commonModule) - configureModule(platformModule, platform) - } - - checkHighlightingInAllFiles() - } - fun testBasic() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testHeaderClass() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testHeaderWithoutImplForBoth() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], TargetPlatformKind.JavaScript) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], TargetPlatformKind.JavaScript) } fun testHeaderPartiallyImplemented() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testHeaderFunctionProperty() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testSuppressHeaderWithoutImpl() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testCatchHeaderExceptionInPlatformModule() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], withStdlibCommon = true) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], withStdlibCommon = true) } fun testUseCorrectBuiltInsForCommonModule() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_8], TargetPlatformKind.JavaScript, - withStdlibCommon = true, useFullJdk = true, configureModule = { module, platform -> + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_8], TargetPlatformKind.JavaScript, + withStdlibCommon = true, useFullJdk = true, configureModule = { module, platform -> if (platform == TargetPlatformKind.JavaScript) { module.addLibrary(ForTestCompileRuntime.stdlibJsForTests()) module.addLibrary(ForTestCompileRuntime.stdlibCommonForTests()) diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt index c74e6377b90..9468f1addc3 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt @@ -21,34 +21,15 @@ import org.jetbrains.kotlin.config.TargetPlatformKind class MultiModuleLineMarkerTest : AbstractMultiModuleLineMarkerTest() { - private fun doTest(vararg platforms: TargetPlatformKind<*>) { - val commonModule = module("common") - commonModule.createFacet(TargetPlatformKind.Common) - - for (platform in platforms) { - val path = when (platform) { - is TargetPlatformKind.Jvm -> "jvm" - is TargetPlatformKind.JavaScript -> "js" - else -> error("Unsupported platform: $platform") - } - val platformModule = module(path) - platformModule.createFacet(platform) - platformModule.enableMultiPlatform() - platformModule.addDependency(commonModule) - } - - checkHighlightingInAllFiles() - } - fun testFromCommonToJvmHeader() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testFromCommonToJvmImpl() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } fun testFromClassToAlias() { - doTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) + doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) } } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt index bbc74f3dcab..c657b1630c7 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt @@ -16,8 +16,6 @@ package org.jetbrains.kotlin.idea.stubs -import com.intellij.codeInsight.completion.CompletionTestCase -import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl import com.intellij.codeInsight.daemon.impl.HighlightInfo import com.intellij.openapi.application.ApplicationManager