From e66768cbb3aecebeb1fb4ce9a0b5ae3d4d49c406 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Wed, 28 Mar 2018 21:03:45 +0200 Subject: [PATCH] Rewrite mpp line marker tests to be generated --- .../kotlin/generators/tests/GenerateTests.kt | 5 + .../{common => a_common_test}/common.kt | 0 .../{js => a_js_test}/test.kt | 0 .../{common => base_common}/common.kt | 0 .../transitive/{jvm_base => base_jvm}/base.kt | 0 .../user.kt | 0 .../{common_base => base_common}/base.kt | 0 .../user.kt | 0 .../{jvm => user_jvm_dep(base-common)}/jvm.kt | 0 .../AbstractMultiModuleLineMarkerTest.kt | 37 ++++ .../resolve/MultiModuleLineMarkerTest.kt | 166 ------------------ .../MultiModuleLineMarkerTestGenerated.java | 165 +++++++++++++++++ .../idea/multiplatform/multiPlatformSetup.kt | 16 ++ 13 files changed, 223 insertions(+), 166 deletions(-) rename idea/testData/multiModuleLineMarker/kotlinTestAnnotations/{common => a_common_test}/common.kt (100%) rename idea/testData/multiModuleLineMarker/kotlinTestAnnotations/{js => a_js_test}/test.kt (100%) rename idea/testData/multiModuleLineMarker/transitive/{common => base_common}/common.kt (100%) rename idea/testData/multiModuleLineMarker/transitive/{jvm_base => base_jvm}/base.kt (100%) rename idea/testData/multiModuleLineMarker/transitive/{jvm_user => user_jvm_dep(base-jvm)_dep(base-common)}/user.kt (100%) rename idea/testData/multiModuleLineMarker/transitiveCommon/{common_base => base_common}/base.kt (100%) rename idea/testData/multiModuleLineMarker/transitiveCommon/{common_user => user_common_dep(base-common)}/user.kt (100%) rename idea/testData/multiModuleLineMarker/transitiveCommon/{jvm => user_jvm_dep(base-common)}/jvm.kt (100%) create mode 100644 idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleLineMarkerTest.kt delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt create mode 100644 idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index df64ba49e0e..bcf93e06c75 100755 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -52,6 +52,7 @@ import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest import org.jetbrains.kotlin.idea.caches.resolve.AbstractIdeCompiledLightClassTest import org.jetbrains.kotlin.idea.caches.resolve.AbstractIdeLightClassTest +import org.jetbrains.kotlin.idea.caches.resolve.AbstractMultiModuleLineMarkerTest import org.jetbrains.kotlin.idea.codeInsight.* import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest @@ -549,6 +550,10 @@ fun main(args: Array) { model("codeInsight/lineMarker") } + testClass { + model("multiModuleLineMarker", extension = null, recursive = false) + } + testClass { model("shortenRefs", pattern = KT_WITHOUT_DOTS_IN_NAME) } diff --git a/idea/testData/multiModuleLineMarker/kotlinTestAnnotations/common/common.kt b/idea/testData/multiModuleLineMarker/kotlinTestAnnotations/a_common_test/common.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/kotlinTestAnnotations/common/common.kt rename to idea/testData/multiModuleLineMarker/kotlinTestAnnotations/a_common_test/common.kt diff --git a/idea/testData/multiModuleLineMarker/kotlinTestAnnotations/js/test.kt b/idea/testData/multiModuleLineMarker/kotlinTestAnnotations/a_js_test/test.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/kotlinTestAnnotations/js/test.kt rename to idea/testData/multiModuleLineMarker/kotlinTestAnnotations/a_js_test/test.kt diff --git a/idea/testData/multiModuleLineMarker/transitive/common/common.kt b/idea/testData/multiModuleLineMarker/transitive/base_common/common.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/transitive/common/common.kt rename to idea/testData/multiModuleLineMarker/transitive/base_common/common.kt diff --git a/idea/testData/multiModuleLineMarker/transitive/jvm_base/base.kt b/idea/testData/multiModuleLineMarker/transitive/base_jvm/base.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/transitive/jvm_base/base.kt rename to idea/testData/multiModuleLineMarker/transitive/base_jvm/base.kt diff --git a/idea/testData/multiModuleLineMarker/transitive/jvm_user/user.kt b/idea/testData/multiModuleLineMarker/transitive/user_jvm_dep(base-jvm)_dep(base-common)/user.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/transitive/jvm_user/user.kt rename to idea/testData/multiModuleLineMarker/transitive/user_jvm_dep(base-jvm)_dep(base-common)/user.kt diff --git a/idea/testData/multiModuleLineMarker/transitiveCommon/common_base/base.kt b/idea/testData/multiModuleLineMarker/transitiveCommon/base_common/base.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/transitiveCommon/common_base/base.kt rename to idea/testData/multiModuleLineMarker/transitiveCommon/base_common/base.kt diff --git a/idea/testData/multiModuleLineMarker/transitiveCommon/common_user/user.kt b/idea/testData/multiModuleLineMarker/transitiveCommon/user_common_dep(base-common)/user.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/transitiveCommon/common_user/user.kt rename to idea/testData/multiModuleLineMarker/transitiveCommon/user_common_dep(base-common)/user.kt diff --git a/idea/testData/multiModuleLineMarker/transitiveCommon/jvm/jvm.kt b/idea/testData/multiModuleLineMarker/transitiveCommon/user_jvm_dep(base-common)/jvm.kt similarity index 100% rename from idea/testData/multiModuleLineMarker/transitiveCommon/jvm/jvm.kt rename to idea/testData/multiModuleLineMarker/transitiveCommon/user_jvm_dep(base-common)/jvm.kt diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleLineMarkerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleLineMarkerTest.kt new file mode 100644 index 00000000000..06042a39336 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractMultiModuleLineMarkerTest.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2016 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.caches.resolve + +import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromDirStructure +import org.jetbrains.kotlin.idea.test.PluginTestCaseBase +import java.io.File + +abstract class AbstractMultiModuleLineMarkerTest : AbstractMultiModuleHighlightingTest() { + + override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/multiModuleLineMarker/" + + override val shouldCheckLineMarkers = true + + override val shouldCheckResult = false + + override fun doTestLineMarkers() = true + + protected fun doTest(path: String) { + setupMppProjectFromDirStructure(File(path)) + checkHighlightingInAllFiles() + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt deleted file mode 100644 index 47a5d3e1412..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTest.kt +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2010-2016 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.caches.resolve - -import com.intellij.openapi.roots.CompilerModuleExtension -import com.intellij.openapi.roots.ModuleRootModificationUtil -import org.jetbrains.kotlin.config.JvmTarget -import org.jetbrains.kotlin.config.TargetPlatformKind -import org.jetbrains.kotlin.idea.stubs.createFacet -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.test.TestJdkKind - -class MultiModuleLineMarkerTest : AbstractMultiModuleHighlightingTest() { - - override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/multiModuleLineMarker/" - - override val shouldCheckLineMarkers = true - - override val shouldCheckResult = false - - override fun doTestLineMarkers() = true - - fun testFromActualAnnotation() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromActualPrimaryConstructor() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromActualSealedClass() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromActualSecondaryConstructor() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromActualTypeAlias() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromClassToAlias() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromClassToJavaAliasInTest() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromCommonToJvmHeader() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromCommonToJvmImpl() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromExpectedAnnotation() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromExpectedPrimaryConstructor() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromExpectedSealedClass() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromExpectedSecondaryConstructor() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testFromExpectedTypeAlias() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testHierarchyWithExpectClassCommonSide() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testHierarchyWithExpectClassCommonSideNonJavaIds() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testHierarchyWithExpectClassPlatformSide() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testKotlinTestAnnotations() { - doMultiPlatformTest(TargetPlatformKind.JavaScript, - configureModule = { module, _ -> - ModuleRootModificationUtil.updateModel(module) { - with(it.getModuleExtension(CompilerModuleExtension::class.java)!!) { - inheritCompilerOutputPath(false) - setCompilerOutputPathForTests("js_out") - } - } - }) - } - - fun testTopLevelFunWithKotlinTest() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } - - fun testSuspendImplInPlatformModules() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], TargetPlatformKind.JavaScript) - } - - fun testTransitive() { - val commonModule = module("common", TestJdkKind.MOCK_JDK) - commonModule.createFacet(TargetPlatformKind.Common, false) - val jvmPlatform = TargetPlatformKind.Jvm[JvmTarget.JVM_1_6] - - val baseModule = module("jvm_base", TestJdkKind.MOCK_JDK) - baseModule.createFacet(jvmPlatform, implementedModuleName = "common") - baseModule.enableMultiPlatform() - baseModule.addDependency(commonModule) - - val userModule = module("jvm_user", TestJdkKind.MOCK_JDK) - userModule.createFacet(jvmPlatform) - userModule.enableMultiPlatform() - userModule.addDependency(commonModule) - userModule.addDependency(baseModule) - - checkHighlightingInAllFiles() - } - - fun testTransitiveCommon() { - val commonBaseModule = module("common_base", TestJdkKind.MOCK_JDK) - commonBaseModule.createFacet(TargetPlatformKind.Common, false) - - val commonUserModule = module("common_user", TestJdkKind.MOCK_JDK) - commonUserModule.createFacet(TargetPlatformKind.Common, false) - commonUserModule.enableMultiPlatform() - commonUserModule.addDependency(commonBaseModule) - - val jvmPlatform = TargetPlatformKind.Jvm[JvmTarget.JVM_1_6] - val jvmModule = module("jvm", TestJdkKind.MOCK_JDK) - jvmModule.createFacet(jvmPlatform, implementedModuleName = "common_user") - jvmModule.enableMultiPlatform() - jvmModule.addDependency(commonBaseModule) - jvmModule.addDependency(commonUserModule) - - checkHighlightingInAllFiles() - } - - fun testWithOverloads() { - doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]) - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTestGenerated.java new file mode 100644 index 00000000000..74e49b0beee --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleLineMarkerTestGenerated.java @@ -0,0 +1,165 @@ +/* + * 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.caches.resolve; + +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/multiModuleLineMarker") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class MultiModuleLineMarkerTestGenerated extends AbstractMultiModuleLineMarkerTest { + public void testAllFilesPresentInMultiModuleLineMarker() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiModuleLineMarker"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false); + } + + @TestMetadata("fromActualAnnotation") + public void testFromActualAnnotation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromActualAnnotation/"); + doTest(fileName); + } + + @TestMetadata("fromActualPrimaryConstructor") + public void testFromActualPrimaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromActualPrimaryConstructor/"); + doTest(fileName); + } + + @TestMetadata("fromActualSealedClass") + public void testFromActualSealedClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromActualSealedClass/"); + doTest(fileName); + } + + @TestMetadata("fromActualSecondaryConstructor") + public void testFromActualSecondaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromActualSecondaryConstructor/"); + doTest(fileName); + } + + @TestMetadata("fromActualTypeAlias") + public void testFromActualTypeAlias() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromActualTypeAlias/"); + doTest(fileName); + } + + @TestMetadata("fromClassToAlias") + public void testFromClassToAlias() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromClassToAlias/"); + doTest(fileName); + } + + @TestMetadata("fromClassToJavaAliasInTest") + public void testFromClassToJavaAliasInTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromClassToJavaAliasInTest/"); + doTest(fileName); + } + + @TestMetadata("fromCommonToJvmHeader") + public void testFromCommonToJvmHeader() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromCommonToJvmHeader/"); + doTest(fileName); + } + + @TestMetadata("fromCommonToJvmImpl") + public void testFromCommonToJvmImpl() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromCommonToJvmImpl/"); + doTest(fileName); + } + + @TestMetadata("fromExpectedAnnotation") + public void testFromExpectedAnnotation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromExpectedAnnotation/"); + doTest(fileName); + } + + @TestMetadata("fromExpectedPrimaryConstructor") + public void testFromExpectedPrimaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromExpectedPrimaryConstructor/"); + doTest(fileName); + } + + @TestMetadata("fromExpectedSealedClass") + public void testFromExpectedSealedClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromExpectedSealedClass/"); + doTest(fileName); + } + + @TestMetadata("fromExpectedSecondaryConstructor") + public void testFromExpectedSecondaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromExpectedSecondaryConstructor/"); + doTest(fileName); + } + + @TestMetadata("fromExpectedTypeAlias") + public void testFromExpectedTypeAlias() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/fromExpectedTypeAlias/"); + doTest(fileName); + } + + @TestMetadata("hierarchyWithExpectClassCommonSide") + public void testHierarchyWithExpectClassCommonSide() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/hierarchyWithExpectClassCommonSide/"); + doTest(fileName); + } + + @TestMetadata("hierarchyWithExpectClassCommonSideNonJavaIds") + public void testHierarchyWithExpectClassCommonSideNonJavaIds() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/hierarchyWithExpectClassCommonSideNonJavaIds/"); + doTest(fileName); + } + + @TestMetadata("hierarchyWithExpectClassPlatformSide") + public void testHierarchyWithExpectClassPlatformSide() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/hierarchyWithExpectClassPlatformSide/"); + doTest(fileName); + } + + @TestMetadata("kotlinTestAnnotations") + public void testKotlinTestAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/kotlinTestAnnotations/"); + doTest(fileName); + } + + @TestMetadata("suspendImplInPlatformModules") + public void testSuspendImplInPlatformModules() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/suspendImplInPlatformModules/"); + doTest(fileName); + } + + @TestMetadata("topLevelFunWithKotlinTest") + public void testTopLevelFunWithKotlinTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/topLevelFunWithKotlinTest/"); + doTest(fileName); + } + + @TestMetadata("transitive") + public void testTransitive() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/transitive/"); + doTest(fileName); + } + + @TestMetadata("transitiveCommon") + public void testTransitiveCommon() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/transitiveCommon/"); + doTest(fileName); + } + + @TestMetadata("withOverloads") + public void testWithOverloads() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/multiModuleLineMarker/withOverloads/"); + doTest(fileName); + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt b/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt index 032f2a91916..1c02a5cc231 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt @@ -8,6 +8,8 @@ package org.jetbrains.kotlin.idea.multiplatform import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.module.Module import com.intellij.openapi.module.StdModuleTypes +import com.intellij.openapi.roots.CompilerModuleExtension +import com.intellij.openapi.roots.ModuleRootModificationUtil import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.testFramework.PlatformTestCase import junit.framework.TestCase @@ -61,10 +63,24 @@ private fun AbstractMultiModuleTest.createModuleWithRoots( val module = createModule(moduleId.ideaModuleName()) for ((_, isTestRoot, moduleRoot) in infos) { addRoot(module, moduleRoot, isTestRoot) + + if (moduleId.platform is TargetPlatformKind.JavaScript && isTestRoot) { + setupJsTestOutput(module) + } } return module } +// test line markers for JS do not work without additional setup +private fun setupJsTestOutput(module: Module) { + ModuleRootModificationUtil.updateModel(module) { + with(it.getModuleExtension(CompilerModuleExtension::class.java)!!) { + inheritCompilerOutputPath(false) + setCompilerOutputPathForTests("js_out") + } + } +} + private fun AbstractMultiModuleTest.createModule(name: String): Module { val moduleDir = PlatformTestCase.createTempDir("") val module = createModule(moduleDir.toString() + "/" + name, StdModuleTypes.JAVA)