diff --git a/idea/testData/multiModuleHighlighting/dependency/m1/m1.kt b/idea/testData/multiModuleHighlighting/dependency/m1/m1.kt new file mode 100644 index 00000000000..8943452d5aa --- /dev/null +++ b/idea/testData/multiModuleHighlighting/dependency/m1/m1.kt @@ -0,0 +1,8 @@ +package foo + +public fun accessM1() { + accessM1() + accessM2() + accessM3() + accessM4() +} \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/dependency/m2/m2.kt b/idea/testData/multiModuleHighlighting/dependency/m2/m2.kt new file mode 100644 index 00000000000..c553f924cff --- /dev/null +++ b/idea/testData/multiModuleHighlighting/dependency/m2/m2.kt @@ -0,0 +1,8 @@ +package foo + +public fun accessM2() { + accessM1() + accessM2() + accessM3() + accessM4() +} \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/dependency/m3/m3.kt b/idea/testData/multiModuleHighlighting/dependency/m3/m3.kt new file mode 100644 index 00000000000..30ead18c906 --- /dev/null +++ b/idea/testData/multiModuleHighlighting/dependency/m3/m3.kt @@ -0,0 +1,8 @@ +package foo + +public fun accessM3() { + accessM1() + accessM2() + accessM3() + accessM4() +} \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/dependency/m4/m4.kt b/idea/testData/multiModuleHighlighting/dependency/m4/m4.kt new file mode 100644 index 00000000000..83c25ac4862 --- /dev/null +++ b/idea/testData/multiModuleHighlighting/dependency/m4/m4.kt @@ -0,0 +1,8 @@ +package foo + +public fun accessM4() { + accessM1() + accessM2() + accessM3() + accessM4() +} \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/visibility/m1/m1.kt b/idea/testData/multiModuleHighlighting/visibility/m1/m1.kt new file mode 100644 index 00000000000..1e75e52a742 --- /dev/null +++ b/idea/testData/multiModuleHighlighting/visibility/m1/m1.kt @@ -0,0 +1,27 @@ +package m1 + +public class PublicClassInM1 +class InternalClassInM1 +private class PrivateClassInM1 + +public fun publicFunInM1() { +} +fun internalFunInM1() { +} +private fun privateFunInM1() { +} + +fun testVisibility() { + ClassInM2() +} + +public open class A internal () { + private fun pri() { + } + fun int() { + } + protected fun pro() { + } + public fun pub() { + } +} \ No newline at end of file diff --git a/idea/testData/multiModuleHighlighting/visibility/m2/m2.kt b/idea/testData/multiModuleHighlighting/visibility/m2/m2.kt new file mode 100644 index 00000000000..f88dfb08d00 --- /dev/null +++ b/idea/testData/multiModuleHighlighting/visibility/m2/m2.kt @@ -0,0 +1,34 @@ +package m2 + +import m1.* + +fun testVisibility() { + PublicClassInM1() + + InternalClassInM1() + + PrivateClassInM1() + + publicFunInM1() + + internalFunInM1() + + privateFunInM1() +} + +public class ClassInM2 + +public class B: A() { + + fun accessA(a: A) {} + + fun f() { + pri() + + pro() + + pub() + + int() + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/caches/resolve/MultiModuleHighlightingTest.kt b/idea/tests/org/jetbrains/jet/plugin/caches/resolve/MultiModuleHighlightingTest.kt new file mode 100644 index 00000000000..f219902df8d --- /dev/null +++ b/idea/tests/org/jetbrains/jet/plugin/caches/resolve/MultiModuleHighlightingTest.kt @@ -0,0 +1,70 @@ +/* + * Copyright 2010-2014 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.jet.plugin.caches.resolve + +import org.jetbrains.jet.plugin.PluginTestCaseBase +import com.intellij.openapi.module.StdModuleTypes +import com.intellij.openapi.roots.ModuleRootModificationUtil +import org.jetbrains.jet.plugin.project.PluginJetFilesProvider +import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase +import com.intellij.openapi.module.Module + +class MultiModuleHighlightingTest : DaemonAnalyzerTestCase() { + + private val TEST_DATA_PATH = PluginTestCaseBase.getTestDataPathBase() + "/multiModuleHighlighting/" + + fun testVisibility() { + val module1 = module("m1") + val module2 = module("m2") + + module2.addDependency(module1) + + checkHighlightingInAllFiles() + } + + fun testDependency() { + val module1 = module("m1") + val module2 = module("m2") + val module3 = module("m3") + val module4 = module("m4") + + module2.addDependency(module1) + + module1.addDependency(module2) + + module3.addDependency(module2) + + module4.addDependency(module1) + module4.addDependency(module2) + module4.addDependency(module3) + + checkHighlightingInAllFiles() + } + + private fun checkHighlightingInAllFiles() { + PluginJetFilesProvider.allFilesInProject(myProject!!).forEach { file -> + configureByExistingFile(file.getVirtualFile()!!) + checkHighlighting(myEditor, true, false) + } + } + + private fun module(name: String): Module { + return createModuleFromTestData(TEST_DATA_PATH + "${getTestName(true)}/$name", "$name", StdModuleTypes.JAVA, true)!! + } + + private fun Module.addDependency(other: Module) = ModuleRootModificationUtil.addDependency(this, other) +} \ No newline at end of file