Mpp highlighting test: make generated, adjust test data
Note: this spawns new test cases which were ignored previously
This commit is contained in:
@@ -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.AbstractMultiModuleHighlightingTest
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.AbstractMultiModuleLineMarkerTest
|
||||
import org.jetbrains.kotlin.idea.codeInsight.*
|
||||
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest
|
||||
@@ -643,6 +644,10 @@ fun main(args: Array<String>) {
|
||||
model("multiFileHighlighting", recursive = false)
|
||||
}
|
||||
|
||||
testClass<AbstractMultiModuleHighlightingTest> {
|
||||
model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractQuickFixMultiModuleTest> {
|
||||
model("multiModuleQuickFix", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module jvm for JVM">My</error> {
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module testModule_JVM for JVM">My</error> {
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ actual class <error descr="[ACTUAL_WITHOUT_EXPECT] Actual class 'Your' has no co
|
||||
|
||||
}
|
||||
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'His' has no actual declaration in module jvm for JVM">His</error> {
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'His' has no actual declaration in module testModule_JVM for JVM">His</error> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module js for JS"><error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module jvm for JVM">My</error></error> {
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module testModule_JS for JS"><error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module testModule_JVM for JVM">My</error></error> {
|
||||
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@
|
||||
expect interface Event
|
||||
|
||||
@Suppress("SOMETHING_WRONG")
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'Wrong' has no actual declaration in module jvm for JVM">Wrong</error>
|
||||
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'Wrong' has no actual declaration in module testModule_JVM for JVM">Wrong</error>
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
expect fun <error descr="[NO_ACTUAL_FOR_EXPECT] Expected function 'foo' has no actual declaration in module jvm_base for JVM">foo</error>(): Int
|
||||
expect fun <error descr="[NO_ACTUAL_FOR_EXPECT] Expected function 'foo' has no actual declaration in module base_JVM for JVM">foo</error>(): Int
|
||||
+7
-32
@@ -16,13 +16,10 @@
|
||||
|
||||
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.framework.CommonLibraryKind
|
||||
import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromDirStructure
|
||||
import org.jetbrains.kotlin.idea.stubs.AbstractMultiHighlightingTest
|
||||
import org.jetbrains.kotlin.idea.stubs.createFacet
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractMultiModuleHighlightingTest : AbstractMultiHighlightingTest() {
|
||||
|
||||
@@ -34,32 +31,10 @@ abstract class AbstractMultiModuleHighlightingTest : AbstractMultiHighlightingTe
|
||||
}
|
||||
}
|
||||
|
||||
protected fun doMultiPlatformTest(
|
||||
vararg platforms: TargetPlatformKind<*>,
|
||||
withStdlibCommon: Boolean = false,
|
||||
configureModule: (Module, TargetPlatformKind<*>) -> Unit = { _, _ -> },
|
||||
jdk: TestJdkKind = TestJdkKind.MOCK_JDK
|
||||
) {
|
||||
val commonModuleName = "common"
|
||||
val commonModule = module(commonModuleName, jdk)
|
||||
commonModule.createFacet(TargetPlatformKind.Common, false)
|
||||
if (withStdlibCommon) {
|
||||
commonModule.addLibrary(ForTestCompileRuntime.stdlibCommonForTests(), kind = CommonLibraryKind)
|
||||
}
|
||||
|
||||
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, jdk)
|
||||
platformModule.createFacet(platform, implementedModuleName = commonModuleName)
|
||||
platformModule.enableMultiPlatform()
|
||||
platformModule.addDependency(commonModule)
|
||||
configureModule(platformModule, platform)
|
||||
}
|
||||
|
||||
protected open fun doTest(path: String) {
|
||||
setupMppProjectFromDirStructure(File(path))
|
||||
checkHighlightingInAllFiles()
|
||||
}
|
||||
|
||||
override fun getTestDataPath() = "${PluginTestCaseBase.getTestDataPathBase()}/multiModuleHighlighting/multiplatform/"
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ abstract class AbstractMultiModuleLineMarkerTest : AbstractMultiModuleHighlighti
|
||||
|
||||
override fun doTestLineMarkers() = true
|
||||
|
||||
protected fun doTest(path: String) {
|
||||
override fun doTest(path: String) {
|
||||
setupMppProjectFromDirStructure(File(path))
|
||||
checkHighlightingInAllFiles()
|
||||
}
|
||||
|
||||
Generated
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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/multiModuleHighlighting/multiplatform")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class MultiModuleHighlightingTestGenerated extends AbstractMultiModuleHighlightingTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiModuleHighlighting/multiplatform"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("basic")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/basic/");
|
||||
}
|
||||
|
||||
@TestMetadata("catchHeaderExceptionInPlatformModule")
|
||||
public void testCatchHeaderExceptionInPlatformModule() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/catchHeaderExceptionInPlatformModule/");
|
||||
}
|
||||
|
||||
@TestMetadata("depends")
|
||||
public void testDepends() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/depends/");
|
||||
}
|
||||
|
||||
@TestMetadata("headerClass")
|
||||
public void testHeaderClass() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/headerClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("headerClassImplTypealias")
|
||||
public void testHeaderClassImplTypealias() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/headerClassImplTypealias/");
|
||||
}
|
||||
|
||||
@TestMetadata("headerFunUsesStdlibInSignature")
|
||||
public void testHeaderFunUsesStdlibInSignature() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/headerFunUsesStdlibInSignature/");
|
||||
}
|
||||
|
||||
@TestMetadata("headerFunctionProperty")
|
||||
public void testHeaderFunctionProperty() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/headerFunctionProperty/");
|
||||
}
|
||||
|
||||
@TestMetadata("headerPartiallyImplemented")
|
||||
public void testHeaderPartiallyImplemented() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/headerPartiallyImplemented/");
|
||||
}
|
||||
|
||||
@TestMetadata("headerWithoutImplForBoth")
|
||||
public void testHeaderWithoutImplForBoth() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/headerWithoutImplForBoth/");
|
||||
}
|
||||
|
||||
@TestMetadata("internal")
|
||||
public void testInternal() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/internal/");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClassWithoutImpl")
|
||||
public void testNestedClassWithoutImpl() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/nestedClassWithoutImpl/");
|
||||
}
|
||||
|
||||
@TestMetadata("suppressHeaderWithoutImpl")
|
||||
public void testSuppressHeaderWithoutImpl() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/suppressHeaderWithoutImpl/");
|
||||
}
|
||||
|
||||
@TestMetadata("transitive")
|
||||
public void testTransitive() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/transitive/");
|
||||
}
|
||||
|
||||
@TestMetadata("triangle")
|
||||
public void testTriangle() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/triangle/");
|
||||
}
|
||||
|
||||
@TestMetadata("triangleWithDependency")
|
||||
public void testTriangleWithDependency() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/triangleWithDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("useCorrectBuiltInsForCommonModule")
|
||||
public void testUseCorrectBuiltInsForCommonModule() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/useCorrectBuiltInsForCommonModule/");
|
||||
}
|
||||
|
||||
@TestMetadata("withOverrides")
|
||||
public void testWithOverrides() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/withOverrides/");
|
||||
}
|
||||
}
|
||||
@@ -1,164 +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.caches.resolve
|
||||
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.TargetPlatformKind
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.stubs.createFacet
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
|
||||
// Some tests are ignored below. They fail because <error> markers are not stripped correctly in multi-module highlighting tests.
|
||||
// TODO: fix this in the test framework and unignore the tests
|
||||
class MultiPlatformHighlightingTest : AbstractMultiModuleHighlightingTest() {
|
||||
override fun getTestDataPath() = "${PluginTestCaseBase.getTestDataPathBase()}/multiModuleHighlighting/multiplatform/"
|
||||
|
||||
fun testBasic() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testDepends() {
|
||||
val commonModule = module("common", TestJdkKind.MOCK_JDK)
|
||||
commonModule.createFacet(TargetPlatformKind.Common)
|
||||
commonModule.enableMultiPlatform()
|
||||
|
||||
val jvmPlatform = TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]
|
||||
val jvmModule = module("jvm", TestJdkKind.MOCK_JDK)
|
||||
jvmModule.createFacet(jvmPlatform)
|
||||
jvmModule.enableMultiPlatform()
|
||||
jvmModule.addDependency(commonModule)
|
||||
|
||||
checkHighlightingInAllFiles()
|
||||
}
|
||||
|
||||
fun testHeaderClass() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testHeaderWithoutImplForBoth() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], TargetPlatformKind.JavaScript)
|
||||
}
|
||||
|
||||
fun ignore_testHeaderPartiallyImplemented() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testHeaderFunctionProperty() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testInternal() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testSuppressHeaderWithoutImpl() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testCatchHeaderExceptionInPlatformModule() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], withStdlibCommon = true)
|
||||
}
|
||||
|
||||
fun testWithOverrides() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testUseCorrectBuiltInsForCommonModule() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_8], TargetPlatformKind.JavaScript,
|
||||
withStdlibCommon = true, jdk = TestJdkKind.FULL_JDK,
|
||||
configureModule = { module, platform ->
|
||||
if (platform == TargetPlatformKind.JavaScript) {
|
||||
module.addLibrary(ForTestCompileRuntime.stdlibJsForTests(), kind = JSLibraryKind)
|
||||
module.addLibrary(ForTestCompileRuntime.stdlibCommonForTests())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun testHeaderClassImplTypealias() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
fun testHeaderFunUsesStdlibInSignature() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6], withStdlibCommon = true, configureModule = { module, platform ->
|
||||
if (platform is TargetPlatformKind.Jvm) {
|
||||
module.addLibrary(ForTestCompileRuntime.runtimeJarForTests())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun ignore_testNestedClassWithoutImpl() {
|
||||
doMultiPlatformTest(TargetPlatformKind.Jvm[JvmTarget.JVM_1_6])
|
||||
}
|
||||
|
||||
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 testTriangle() {
|
||||
val commonModule = module("common_base", TestJdkKind.MOCK_JDK)
|
||||
commonModule.createFacet(TargetPlatformKind.Common, false)
|
||||
|
||||
val derivedModule = module("common_derived", TestJdkKind.MOCK_JDK)
|
||||
derivedModule.createFacet(TargetPlatformKind.Common)
|
||||
derivedModule.enableMultiPlatform()
|
||||
|
||||
val jvmPlatform = TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]
|
||||
val jvmModule = module("jvm_derived", TestJdkKind.MOCK_JDK)
|
||||
jvmModule.createFacet(jvmPlatform, implementedModuleName = "common_derived")
|
||||
jvmModule.enableMultiPlatform()
|
||||
jvmModule.addDependency(commonModule)
|
||||
jvmModule.addDependency(derivedModule)
|
||||
|
||||
checkHighlightingInAllFiles()
|
||||
}
|
||||
|
||||
fun testTriangleWithDependency() {
|
||||
val commonModule = module("common_base", TestJdkKind.MOCK_JDK)
|
||||
commonModule.createFacet(TargetPlatformKind.Common, false)
|
||||
|
||||
val derivedModule = module("common_derived", TestJdkKind.MOCK_JDK)
|
||||
derivedModule.createFacet(TargetPlatformKind.Common)
|
||||
derivedModule.enableMultiPlatform()
|
||||
derivedModule.addDependency(commonModule)
|
||||
|
||||
val jvmPlatform = TargetPlatformKind.Jvm[JvmTarget.JVM_1_6]
|
||||
val jvmModule = module("jvm_derived", TestJdkKind.MOCK_JDK)
|
||||
jvmModule.createFacet(jvmPlatform, implementedModuleName = "common_derived")
|
||||
jvmModule.enableMultiPlatform()
|
||||
jvmModule.addDependency(commonModule)
|
||||
jvmModule.addDependency(derivedModule)
|
||||
|
||||
checkHighlightingInAllFiles()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user