diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTestBase.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTestBase.kt index f1c464e46be0..3fcfd31d7143 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTestBase.kt +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTestBase.kt @@ -25,6 +25,7 @@ import junit.framework.TestCase import org.jetbrains.kotlin.formatter.FormatSettingsUtil import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.codeInsight.hints.KotlinAbstractHintsProvider +import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager import org.jetbrains.kotlin.idea.test.* import org.jetbrains.kotlin.idea.util.application.executeCommand import org.jetbrains.kotlin.idea.util.application.executeWriteCommand @@ -124,6 +125,10 @@ abstract class AbstractIntentionTestBase : KotlinLightCodeInsightFixtureTestCase val pathToFiles = mapOf(*(sourceFilePaths zip psiFiles).toTypedArray()) ConfigLibraryUtil.configureLibrariesByDirective(module, fileText) + if ((myFixture.file as? KtFile)?.isScript() == true) { + ScriptConfigurationManager.updateScriptDependenciesSynchronously(myFixture.file) + } + configureCodeStyleAndRun(project, { FormatSettingsUtil.createConfigurator(fileText, it).configureSettings() }) { configureRegistryAndRun(fileText) { try { diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java index 89646df0e198..5c3fa8d264e1 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java @@ -14107,6 +14107,11 @@ public abstract class K1IntentionTestGenerated extends AbstractK1IntentionTest { public void testRedeclarationPropertyConflict() throws Exception { runTest("testData/intentions/moveMemberToTopLevel/redeclarationPropertyConflict.kt"); } + + @TestMetadata("script.kts") + public void testScript() throws Exception { + runTest("testData/intentions/moveMemberToTopLevel/script.kts"); + } } @RunWith(JUnit3RunnerWithInners.class) diff --git a/plugins/kotlin/idea/tests/testData/intentions/moveMemberToTopLevel/script.kts b/plugins/kotlin/idea/tests/testData/intentions/moveMemberToTopLevel/script.kts new file mode 100644 index 000000000000..35fba43f0d23 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/intentions/moveMemberToTopLevel/script.kts @@ -0,0 +1,5 @@ +// RUNTIME_WITH_SCRIPT_RUNTIME +object Foo { + fun foo() = 1 + val a = 1 +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/moveMemberToTopLevel/script.kts.after b/plugins/kotlin/idea/tests/testData/intentions/moveMemberToTopLevel/script.kts.after new file mode 100644 index 000000000000..f20263622cd2 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/intentions/moveMemberToTopLevel/script.kts.after @@ -0,0 +1,6 @@ +// RUNTIME_WITH_SCRIPT_RUNTIME +object Foo { + val a = 1 +} + +fun foo() = 1