Test completion in script files
Test for 'JavaResolutionUtils.getJavaDescriptorResolver' failing with AE
Tests ebd3ac6dc8
See EA-105435
This commit is contained in:
@@ -128,6 +128,7 @@ import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractMultiModuleSafeD
|
||||
import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractSafeDeleteTest
|
||||
import org.jetbrains.kotlin.idea.repl.AbstractIdeReplCompletionTest
|
||||
import org.jetbrains.kotlin.idea.resolve.*
|
||||
import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationCompletionTest
|
||||
import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationHighlightingTest
|
||||
import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationNavigationTest
|
||||
import org.jetbrains.kotlin.idea.slicer.AbstractSlicerTest
|
||||
@@ -704,6 +705,10 @@ fun main(args: Array<String>) {
|
||||
model("script/definition/navigation", extension = null, recursive = false)
|
||||
}
|
||||
|
||||
testClass<AbstractScriptConfigurationCompletionTest> {
|
||||
model("script/definition/completion", extension = null, recursive = false)
|
||||
}
|
||||
|
||||
testClass<AbstractNameSuggestionProviderTest> {
|
||||
model("refactoring/nameSuggestionProvider")
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
object KObject {
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
test.KObje<caret>
|
||||
|
||||
// DEPENDENCIES: classpath:lib-classes; sources:lib-source
|
||||
// CONFLICTING_MODULE
|
||||
// EXIST: KObject
|
||||
// NOTHING_ELSE
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class JavaClass {
|
||||
public static void staticMethod() {
|
||||
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
staticMeth<caret>
|
||||
|
||||
// DEPENDENCIES: classpath:lib-classes; sources:lib-source
|
||||
// CONFLICTING_MODULE
|
||||
// EXIST: staticMethod
|
||||
// INVOCATION_COUNT: 2
|
||||
// NOTHING_ELSE
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.script
|
||||
|
||||
import org.jetbrains.kotlin.idea.completion.test.testCompletion
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
|
||||
abstract class AbstractScriptConfigurationCompletionTest : AbstractScriptConfigurationTest() {
|
||||
fun doTest(path: String) {
|
||||
configureScriptFile(path)
|
||||
testCompletion(file.text, JvmPlatform, additionalValidDirectives = switches, complete = { completionType, count ->
|
||||
setType(completionType)
|
||||
complete(count)
|
||||
myItems
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.idea.KotlinDaemonAnalyzerTestCase
|
||||
import org.jetbrains.kotlin.idea.completion.test.KotlinCompletionTestCase
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionContributor
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesManager.Companion.updateScriptDependenciesSynchronously
|
||||
@@ -74,12 +74,12 @@ private const val useDefaultTemplate = "// DEPENDENCIES:"
|
||||
private const val configureConflictingModule = "// CONFLICTING_MODULE"
|
||||
|
||||
private fun String.splitOrEmpty(delimeters: String) = split(delimeters).takeIf { it.size > 1 } ?: emptyList()
|
||||
private val switches = listOf(
|
||||
internal val switches = listOf(
|
||||
useDefaultTemplate,
|
||||
configureConflictingModule
|
||||
)
|
||||
|
||||
abstract class AbstractScriptConfigurationTest : KotlinDaemonAnalyzerTestCase() {
|
||||
abstract class AbstractScriptConfigurationTest : KotlinCompletionTestCase() {
|
||||
|
||||
protected fun configureScriptFile(path: String) {
|
||||
val environment = createScriptEnvironment(path)
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.script;
|
||||
|
||||
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/script/definition/completion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class ScriptConfigurationCompletionTestGenerated extends AbstractScriptConfigurationCompletionTest {
|
||||
public void testAllFilesPresentInCompletion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/script/definition/completion"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingModule")
|
||||
public void testConflictingModule() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/completion/conflictingModule/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingModuleJavaLib")
|
||||
public void testConflictingModuleJavaLib() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/completion/conflictingModuleJavaLib/");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user