[Expect/Actual] Add testdata on hierarchical expect/actual matching

This commit is contained in:
Dmitry Savvinov
2019-04-23 20:59:07 +03:00
parent cac326bf4a
commit 54b8f9da28
70 changed files with 508 additions and 20 deletions
@@ -41,10 +41,7 @@ import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
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.caches.resolve.AbstractMultiPlatformHighlightingTest
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.codeInsight.*
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest
@@ -672,6 +669,10 @@ fun main(args: Array<String>) {
model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null)
}
testClass<AbstractHierarchicalExpectActualTest> {
model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null)
}
testClass<AbstractQuickFixMultiModuleTest> {
model("multiModuleQuickFix", recursive = false, extension = null)
}
@@ -50,10 +50,7 @@ import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
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.caches.resolve.AbstractMultiPlatformHighlightingTest
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.codeInsight.*
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest
@@ -685,6 +682,10 @@ fun main(args: Array<String>) {
model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null)
}
testClass<AbstractHierarchicalExpectActualTest> {
model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null)
}
testClass<AbstractQuickFixMultiModuleTest> {
model("multiModuleQuickFix", recursive = false, extension = null)
}
@@ -41,10 +41,7 @@ import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
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.caches.resolve.AbstractMultiPlatformHighlightingTest
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.codeInsight.*
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest
@@ -649,6 +646,10 @@ fun main(args: Array<String>) {
model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null)
}
testClass<AbstractHierarchicalExpectActualTest> {
model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null)
}
testClass<AbstractQuickFixMultiModuleTest> {
model("multiModuleQuickFix", recursive = false, extension = null)
}
@@ -41,10 +41,7 @@ import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
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.caches.resolve.AbstractMultiPlatformHighlightingTest
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.codeInsight.*
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest
@@ -653,6 +650,10 @@ fun main(args: Array<String>) {
model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null)
}
testClass<AbstractHierarchicalExpectActualTest> {
model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null)
}
testClass<AbstractQuickFixMultiModuleTest> {
model("multiModuleQuickFix", recursive = false, extension = null)
}
@@ -41,10 +41,7 @@ import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
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.caches.resolve.AbstractMultiPlatformHighlightingTest
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.codeInsight.*
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest
@@ -651,6 +648,10 @@ fun main(args: Array<String>) {
model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null)
}
testClass<AbstractHierarchicalExpectActualTest> {
model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null)
}
testClass<AbstractQuickFixMultiModuleTest> {
model("multiModuleQuickFix", recursive = false, extension = null)
}
@@ -0,0 +1,3 @@
package sample
actual class A
@@ -0,0 +1,8 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE left { platform=[JVM, JS, Native] }
MODULE right { platform=[JVM, JS, Native] }
MODULE bottom { platform=[JVM] }
left -> top { kind=DEPENDS_ON }
right -> top { kind=DEPENDS_ON }
bottom -> left, right { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
package sample
expect class A
@@ -0,0 +1,6 @@
package sample
fun main() {
ActualizedInLeft()
ActualizedInRight()
}
@@ -0,0 +1,8 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE left { platform=[JVM, JS, Native] }
MODULE right { platform=[JVM, JS, Native] }
MODULE bottom { platform=[JVM] }
left -> top { kind=DEPENDS_ON }
right -> top { kind=DEPENDS_ON }
bottom -> left, right { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
package sample
actual class ActualizedInLeft
@@ -0,0 +1,3 @@
package sample
actual class ActualizedInRight
@@ -0,0 +1,4 @@
package sample
expect class ActualizedInLeft
expect class ActualizedInRight
@@ -0,0 +1,16 @@
package sample
actual class A {
actual fun foo(): Int = 45
fun fromBottom(): Int = 0
}
fun main() {
A().foo()
// Any behaviour is acceptable, as the code is erroneous.
// At the time of writing this test, we resolve to nearest A, i.e.
// 'fromBottom' is resolved, and 'fromLeft' is not.
A().<!UNRESOLVED_REFERENCE("fromLeft")!>fromLeft<!>()
A().fromBottom()
}
@@ -0,0 +1,8 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE left { platform=[JVM, JS, Native] }
MODULE right { platform=[JVM, JS, Native] }
MODULE bottom { platform=[JVM] }
left -> top { kind=DEPENDS_ON }
right -> top { kind=DEPENDS_ON }
bottom -> left, right { kind=DEPENDS_ON }
@@ -0,0 +1,6 @@
package sample
actual class A /* Left */ {
actual fun foo(): Int = 42
fun fromLeft(): String = ""
}
@@ -0,0 +1,5 @@
package sample
expect class <!AMBIGUOUS_ACTUALS("Class 'A'", "bottom for JVM, left")!>A<!> {
fun <!AMBIGUOUS_ACTUALS("Function 'foo'", "bottom for JVM, left")!>foo<!>(): Int
}
@@ -0,0 +1,7 @@
package sample
fun main() {
A().foo()
// fromLeft should be resolved, because 'left' comes first in dependencies order!
A().fromLeft()
}
@@ -0,0 +1,8 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE left { platform=[JVM, JS, Native] }
MODULE right { platform=[JVM, JS, Native] }
MODULE bottom { platform=[JVM] }
left -> top { kind=DEPENDS_ON }
right -> top { kind=DEPENDS_ON }
bottom -> left, right { kind=DEPENDS_ON }
@@ -0,0 +1,6 @@
package sample
actual class A /* Left */ {
actual fun foo(): Int = 42
fun fromLeft(): String = ""
}
@@ -0,0 +1,5 @@
package sample
actual class A /* Right */ {
actual fun foo(): Int = 100500
}
@@ -0,0 +1,5 @@
package sample
expect class A {
fun foo(): Int
}
@@ -0,0 +1,8 @@
actual class A
// Error: ACTUAL_WITHOUT_EXPECT, becuase we shouldn't see expects through usual dependencies
actual class <!ACTUAL_WITHOUT_EXPECT("Actual class 'B'", "")!>B<!>
// OK: though we can't actualize B, we can see it and use it.
fun useB(<!UNUSED_PARAMETER("b")!>b<!>: B) {
}
@@ -0,0 +1,8 @@
actual class A
// Error: ACTUAL_WITHOUT_EXPECT, becuase we shouldn't see expects through usual dependencies
actual class <!ACTUAL_WITHOUT_EXPECT("Actual class 'B'", "")!>B<!>
// OK: though we can't actualize B, we can see it and use it.
fun useB(<!UNUSED_PARAMETER("b")!>b<!>: B) {
}
@@ -0,0 +1 @@
expect class <!NO_ACTUAL_FOR_EXPECT("class 'B'", "b-common", "")!>B<!>
@@ -0,0 +1,9 @@
MODULE a-common { platform=[JVM, JS, Native] }
MODULE a-js { platform=[JS] }
MODULE a-jvm { platform=[JVM] }
MODULE b-common { platform=[JVM, JS, Native] }
a-js -> a-common { kind=DEPENDS_ON }
a-jvm -> a-common { kind=DEPENDS_ON }
a-common -> b-common { kind=DEPENDENCY }
@@ -0,0 +1,3 @@
package foo
actual class A
@@ -0,0 +1,6 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE middle { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
middle -> top { kind=DEPENDS_ON }
bottom -> middle { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
package foo
actual class A
@@ -0,0 +1,3 @@
package foo
expect class <!AMBIGUOUS_ACTUALS("Class 'A'", "bottom for JVM, middle")!>A<!>
@@ -0,0 +1,6 @@
package foo
class <!ACTUAL_MISSING!>ActualInMiddleCompatibleInBottom<!>
actual class CompatibleInMiddleActualInBottom
class <!ACTUAL_MISSING!>CompatibleInMiddleAndBottom<!>
@@ -0,0 +1,6 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE middle { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
middle -> top { kind=DEPENDS_ON }
bottom -> middle { kind=DEPENDS_ON }
@@ -0,0 +1,6 @@
package foo
actual class ActualInMiddleCompatibleInBottom
class <!ACTUAL_MISSING!>CompatibleInMiddleActualInBottom<!>
class <!ACTUAL_MISSING!>CompatibleInMiddleAndBottom<!>
@@ -0,0 +1,6 @@
package foo
expect class <!AMBIGUOUS_ACTUALS("Class 'ActualInMiddleCompatibleInBottom'", "bottom for JVM, middle")!>ActualInMiddleCompatibleInBottom<!>
expect class <!AMBIGUOUS_ACTUALS("Class 'CompatibleInMiddleActualInBottom'", "bottom for JVM, middle")!>CompatibleInMiddleActualInBottom<!>
expect class <!AMBIGUOUS_ACTUALS("Class 'CompatibleInMiddleAndBottom'", "bottom for JVM, middle")!>CompatibleInMiddleAndBottom<!>
@@ -0,0 +1,3 @@
package foo
<!ACTUAL_WITHOUT_EXPECT("Class 'A'", " The following declaration is incompatible because visibility is different: public final expect class A ")!>private<!> class A
@@ -0,0 +1,6 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE middle { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
middle -> top { kind=DEPENDS_ON }
bottom -> middle { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
package foo
expect class <!AMBIGUOUS_ACTUALS("Class 'A'", "middle, bottom for JVM")!>A<!>
@@ -0,0 +1,3 @@
package foo
actual fun foo<!ACTUAL_WITHOUT_EXPECT("Actual function 'foo'", " The following declaration is incompatible because number of value parameters is different: public expect fun foo(): Int ")!>(x: Int)<!>: Int = x
@@ -0,0 +1,6 @@
MODULE top { platform=[JVM, JS, Native] }
MODULE middle { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
middle -> top { kind=DEPENDS_ON }
bottom -> middle { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
package foo
actual fun foo(): Int = 42
@@ -0,0 +1,3 @@
package foo
expect fun foo(): Int
@@ -0,0 +1 @@
actual class <!AMBIGUOUS_EXPECTS("Actual class 'A'", "right, left")!>A<!>
@@ -0,0 +1,6 @@
MODULE right { platform=[JVM, Native] }
MODULE left { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
bottom -> right { kind=DEPENDS_ON }
bottom -> left { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
// Note that here we have no ambiguity, becuase we don't consider
// declarations without 'expect' as potential weakly-compatible 'expect'-counterpart
actual class A
@@ -0,0 +1,6 @@
MODULE right { platform=[JVM, Native] }
MODULE left { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
bottom -> right { kind=DEPENDS_ON }
bottom -> left { kind=DEPENDS_ON }
@@ -0,0 +1 @@
expect class <!AMBIGUOUS_ACTUALS("Class 'A'", "bottom.kt, right.kt")!>A<!>
@@ -0,0 +1,6 @@
MODULE right { platform=[JVM, Native] }
MODULE left { platform=[JVM, JS] }
MODULE bottom { platform=[JVM] }
bottom -> right { kind=DEPENDS_ON }
bottom -> left { kind=DEPENDS_ON }
@@ -0,0 +1 @@
expect fun foo<!NO_ACTUAL_FOR_EXPECT("function 'foo'", "bottom for JVM", " The following declaration is incompatible because number of value parameters is different: public actual fun foo(): Int ")!>(x: Int)<!>: Int
@@ -0,0 +1,6 @@
package foo
expect class ExpectInCommonActualInMiddle
expect class ExpectInCommonActualInPlatforms
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInCommonWithoutActual'", "js for JS", ""), NO_ACTUAL_FOR_EXPECT("class 'ExpectInCommonWithoutActual'", "jvm for JVM", "")!>ExpectInCommonWithoutActual<!>
@@ -0,0 +1,8 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvmAndJs { platform=[JVM, JS] }
MODULE jvm { platform=[JVM] }
MODULE js { platform=[JS] }
jvm -> jvmAndJs { kind=DEPENDS_ON }
js -> jvmAndJs { kind=DEPENDS_ON }
jvmAndJs -> common { kind=DEPENDS_ON }
@@ -0,0 +1,10 @@
package foo
actual class ExpectInCommonActualInPlatforms
actual class ExpectInMiddleActualInPlatforms
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInJsWithoutActual'", "js for JS", "")!>ExpectInJsWithoutActual<!>
expect class ExpectInJsActualInJs
actual class ExpectInJsActualInJs
@@ -0,0 +1,9 @@
package foo
actual class ExpectInCommonActualInPlatforms
actual class ExpectInMiddleActualInPlatforms
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInJvmWithoutActual'", "jvm for JVM", "")!>ExpectInJvmWithoutActual<!>
expect class ExpectInJvmActualInJvm
actual class ExpectInJvmActualInJvm
@@ -0,0 +1,7 @@
package foo
actual class ExpectInCommonActualInMiddle
expect class ExpectInMiddleActualInPlatforms
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInMiddleWithoutActual'", "js for JS", ""), NO_ACTUAL_FOR_EXPECT("class 'ExpectInMiddleWithoutActual'", "jvm for JVM", "")!>ExpectInMiddleWithoutActual<!>
@@ -0,0 +1,4 @@
package foo
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInCommonActualInJsOnly'", "jvm for JVM", "")!>ExpectInCommonActualInJsOnly<!>
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInCommonActualInJvmOnly'", "js for JS", "")!>ExpectInCommonActualInJvmOnly<!>
@@ -0,0 +1,8 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvmAndJs { platform=[JVM, JS] }
MODULE jvm { platform=[JVM] }
MODULE js { platform=[JS] }
jvm -> jvmAndJs { kind=DEPENDS_ON }
js -> jvmAndJs { kind=DEPENDS_ON }
jvmAndJs -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
package foo
actual class ExpectInCommonActualInJsOnly
actual class ExpectInMiddleActualInJsOnly
@@ -0,0 +1,4 @@
package foo
actual class ExpectInCommonActualInJvmOnly
actual class ExpectInMiddleActualInJvmOnly
@@ -0,0 +1,4 @@
package foo
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInMiddleActualInJsOnly'", "jvm for JVM", "")!>ExpectInMiddleActualInJsOnly<!>
expect class <!NO_ACTUAL_FOR_EXPECT("class 'ExpectInMiddleActualInJvmOnly'", "js for JS", "")!>ExpectInMiddleActualInJvmOnly<!>
@@ -0,0 +1,91 @@
/*
* Copyright 2010-2019 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.psi.PsiFile
import com.intellij.util.io.exists
import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromTextFile
import org.jetbrains.kotlin.idea.project.platform
import org.jetbrains.kotlin.idea.resolve.frontendService
import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
import org.jetbrains.kotlin.idea.test.allKotlinFiles
import org.jetbrains.kotlin.idea.util.module
import org.jetbrains.kotlin.idea.util.sourceRoots
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
import java.nio.file.Paths
abstract class AbstractMultiModuleIdeResolveTest : AbstractMultiModuleTest() {
fun doTest(testDataPath: String) {
val testRoot = File(testDataPath)
val dependenciesTxt = File(testDataPath, "dependencies.txt")
require(dependenciesTxt.exists()) {
"${dependenciesTxt.absolutePath} does not exist. dependencies.txt is required"
}
// This will implicitly copy all source files to temporary directory, clearing them from diagnostic markup in process
setupMppProjectFromTextFile(testRoot)
for (tempFile in project.allKotlinFiles()) {
checkFile(tempFile, tempFile.findCorrespondingFileInTestDir(testRoot))
}
}
private fun KtFile.findCorrespondingFileInTestDir(testDir: File): File {
val tempRootPath = Paths.get(this.module!!.sourceRoots.single().path)
val tempProjectDirPath = tempRootPath.parent
val tempSourcePath = Paths.get(this.virtualFilePath)
val relativeToProjectRootPath = tempProjectDirPath.relativize(tempSourcePath)
val testSourcesProjectDirPath = testDir.toPath()
val testSourcePath = testSourcesProjectDirPath.resolve(relativeToProjectRootPath)
require(testSourcePath.exists()) {
"Can't find file in testdata for copied file $this: checked at path ${testSourcePath.toAbsolutePath()}"
}
return testSourcePath.toFile()
}
protected open fun checkFile(file: KtFile, expectedFile: File) {
val resolutionFacade = file.getResolutionFacade()
val (bindingContext, moduleDescriptor) = resolutionFacade.analyzeWithAllCompilerChecks(listOf(file))
val actualDiagnostics = CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(
bindingContext,
file,
markDynamicCalls = false,
dynamicCallDescriptors = mutableListOf(),
platform = null, // we don't need to attach platform-description string to diagnostic here
withNewInference = false,
languageVersionSettings = resolutionFacade.frontendService(),
dataFlowValueFactory = resolutionFacade.frontendService(),
moduleDescriptor = moduleDescriptor as ModuleDescriptorImpl
)
val actualTextWithDiagnostics = CheckerTestUtil.addDiagnosticMarkersToText(
file,
actualDiagnostics,
diagnosticToExpectedDiagnostic = emptyMap(),
getFileText = { it.text },
uncheckedDiagnostics = emptyList(),
withNewInferenceDirective = false,
renderDiagnosticMessages = true
).toString()
KotlinTestUtils.assertEqualsToFile(expectedFile, actualTextWithDiagnostics)
}
}
abstract class AbstractHierarchicalExpectActualTest : AbstractMultiModuleIdeResolveTest() {
override fun getTestDataPath(): String = "${PluginTestCaseBase.getTestDataPathBase()}/hierarchicalExpectActual"
}
@@ -0,0 +1,96 @@
/*
* Copyright 2010-2019 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/hierarchicalExpectActualMatching")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class HierarchicalExpectActualTestGenerated extends AbstractHierarchicalExpectActualTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInHierarchicalExpectActualMatching() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
}
@TestMetadata("diamondActualOnOnePath")
public void testDiamondActualOnOnePath() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/diamondActualOnOnePath/");
}
@TestMetadata("diamondDuplicateActuals")
public void testDiamondDuplicateActuals() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/diamondDuplicateActuals/");
}
@TestMetadata("diamondSeesTwoActuals")
public void testDiamondSeesTwoActuals() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/diamondSeesTwoActuals/");
}
@TestMetadata("differentKindsOfDependencies")
public void testDifferentKindsOfDependencies() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/differentKindsOfDependencies/");
}
@TestMetadata("duplicateActualsExplicit")
public void testDuplicateActualsExplicit() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateActualsExplicit/");
}
@TestMetadata("duplicateActualsImplicit")
public void testDuplicateActualsImplicit() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateActualsImplicit/");
}
@TestMetadata("duplicateActualsOneWeaklyIncompatible")
public void testDuplicateActualsOneWeaklyIncompatible() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateActualsOneWeaklyIncompatible/");
}
@TestMetadata("duplicateActualsOneWithStrongIncompatibility")
public void testDuplicateActualsOneWithStrongIncompatibility() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateActualsOneWithStrongIncompatibility/");
}
@TestMetadata("duplicateExpectsExplicit")
public void testDuplicateExpectsExplicit() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateExpectsExplicit/");
}
@TestMetadata("duplicateExpectsImplicit")
public void testDuplicateExpectsImplicit() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateExpectsImplicit/");
}
@TestMetadata("duplicateExpectsWithStrongIncompatibility")
public void testDuplicateExpectsWithStrongIncompatibility() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/duplicateExpectsWithStrongIncompatibility/");
}
@TestMetadata("hierarcicalActualization")
public void testHierarcicalActualization() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/hierarcicalActualization/");
}
@TestMetadata("incompleteActualization")
public void testIncompleteActualization() throws Exception {
runTest("idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/incompleteActualization/");
}
}