diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index ffead014e38..34c748b4a44 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -121,10 +121,7 @@ import org.jetbrains.kotlin.idea.navigation.* import org.jetbrains.kotlin.idea.navigationToolbar.AbstractKotlinNavBarTest import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest import org.jetbrains.kotlin.idea.perf.* -import org.jetbrains.kotlin.idea.quickfix.AbstractHighLevelQuickFixTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest +import org.jetbrains.kotlin.idea.quickfix.* import org.jetbrains.kotlin.idea.refactoring.AbstractNameSuggestionProviderTest import org.jetbrains.kotlin.idea.refactoring.copy.AbstractCopyTest import org.jetbrains.kotlin.idea.refactoring.copy.AbstractMultiModuleCopyTest @@ -1180,6 +1177,10 @@ fun main(args: Array) { model("quickfix/when", pattern = pattern, filenameStartsLowerCase = true) } + testClass { + model("quickfix/autoImports", pattern = """^(\w+)\.((before\.Main\.\w+))$""", testMethod = "doTestWithExtraFile") + } + testClass { val pattern = "^(inspections\\.test)$" model("inspections/redundantUnitReturnType", pattern = pattern, singleClass = true) diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/AbstractHighLevelQuickFixMultiFileTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/AbstractHighLevelQuickFixMultiFileTest.kt new file mode 100644 index 00000000000..68758a40b40 --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/AbstractHighLevelQuickFixMultiFileTest.kt @@ -0,0 +1,38 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.quickfix + +import com.intellij.codeInsight.intention.IntentionAction +import com.intellij.psi.PsiFile +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.utils.IgnoreTests +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths + +abstract class AbstractHighLevelQuickFixMultiFileTest : AbstractQuickFixMultiFileTest() { + override fun doTestWithExtraFile(beforeFileName: String) { + IgnoreTests.runTestIfNotDisabledByFileDirective( + Paths.get(beforeFileName), + disableTestDirective = IgnoreTests.DIRECTIVES.IGNORE_FIR_MULTILINE_COMMENT, + directivePosition = IgnoreTests.DirectivePosition.LAST_LINE_IN_FILE, + computeAdditionalFiles = { mainTestFile -> listOfNotNull(mainTestFile.getAfterFileIfExists()) }, + test = { super.doTestWithExtraFile(beforeFileName) } + ) + } + + override val captureExceptions: Boolean = false + + override fun checkForUnexpectedErrors(file: KtFile) {} + + override fun checkAvailableActionsAreExpected(file: PsiFile, actions: Collection) {} + + private fun Path.getAfterFileIfExists(): Path? { + val afterFileName = fileName.toString().removeSuffix(".before.Main.kt") + ".after.kt" + + return resolveSibling(afterFileName).takeIf(Files::exists) + } +} \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixMultiFileTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixMultiFileTestGenerated.java new file mode 100644 index 00000000000..231ec4b65f4 --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixMultiFileTestGenerated.java @@ -0,0 +1,377 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.quickfix; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.util.KtTestUtil; +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/quickfix/autoImports") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class HighLevelQuickFixMultiFileTestGenerated extends AbstractHighLevelQuickFixMultiFileTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath); + } + + public void testAllFilesPresentInAutoImports() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/autoImports"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+))$"), null, true); + } + + @TestMetadata("ambiguousNamePreferFromJdk.before.Main.kt") + public void testAmbiguousNamePreferFromJdk() throws Exception { + runTest("idea/testData/quickfix/autoImports/ambiguousNamePreferFromJdk.before.Main.kt"); + } + + @TestMetadata("ambiguousNamePreferWithImportsFromPackage.before.Main.kt") + public void testAmbiguousNamePreferWithImportsFromPackage() throws Exception { + runTest("idea/testData/quickfix/autoImports/ambiguousNamePreferWithImportsFromPackage.before.Main.kt"); + } + + @TestMetadata("callWithTrailingComma.before.Main.kt") + public void testCallWithTrailingComma() throws Exception { + runTest("idea/testData/quickfix/autoImports/callWithTrailingComma.before.Main.kt"); + } + + @TestMetadata("callableReferenceExtension.before.Main.kt") + public void testCallableReferenceExtension() throws Exception { + runTest("idea/testData/quickfix/autoImports/callableReferenceExtension.before.Main.kt"); + } + + @TestMetadata("callableReferenceExtension2.before.Main.kt") + public void testCallableReferenceExtension2() throws Exception { + runTest("idea/testData/quickfix/autoImports/callableReferenceExtension2.before.Main.kt"); + } + + @TestMetadata("callableReferenceTopLevel.before.Main.kt") + public void testCallableReferenceTopLevel() throws Exception { + runTest("idea/testData/quickfix/autoImports/callableReferenceTopLevel.before.Main.kt"); + } + + @TestMetadata("classImport.before.Main.kt") + public void testClassImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/classImport.before.Main.kt"); + } + + @TestMetadata("constructorReference.before.Main.kt") + public void testConstructorReference() throws Exception { + runTest("idea/testData/quickfix/autoImports/constructorReference.before.Main.kt"); + } + + @TestMetadata("divOperator.before.Main.kt") + public void testDivOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/divOperator.before.Main.kt"); + } + + @TestMetadata("dslMarkers.before.Main.kt") + public void testDslMarkers() throws Exception { + runTest("idea/testData/quickfix/autoImports/dslMarkers.before.Main.kt"); + } + + @TestMetadata("dslMarkersOnReceiver.before.Main.kt") + public void testDslMarkersOnReceiver() throws Exception { + runTest("idea/testData/quickfix/autoImports/dslMarkersOnReceiver.before.Main.kt"); + } + + @TestMetadata("extensionFunctionImport.before.Main.kt") + public void testExtensionFunctionImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/extensionFunctionImport.before.Main.kt"); + } + + @TestMetadata("extensionFunctionImportImplicitReceiver.before.Main.kt") + public void testExtensionFunctionImportImplicitReceiver() throws Exception { + runTest("idea/testData/quickfix/autoImports/extensionFunctionImportImplicitReceiver.before.Main.kt"); + } + + @TestMetadata("extensionPropertyImport.before.Main.kt") + public void testExtensionPropertyImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/extensionPropertyImport.before.Main.kt"); + } + + @TestMetadata("extensionPropertyOnTypeAliasFromExpansion.before.Main.kt") + public void testExtensionPropertyOnTypeAliasFromExpansion() throws Exception { + runTest("idea/testData/quickfix/autoImports/extensionPropertyOnTypeAliasFromExpansion.before.Main.kt"); + } + + @TestMetadata("extensionPropertyOnTypeAliasFromOtherTypeAlias.before.Main.kt") + public void testExtensionPropertyOnTypeAliasFromOtherTypeAlias() throws Exception { + runTest("idea/testData/quickfix/autoImports/extensionPropertyOnTypeAliasFromOtherTypeAlias.before.Main.kt"); + } + + @TestMetadata("factoryFunctionFromLambda.before.Main.kt") + public void testFactoryFunctionFromLambda() throws Exception { + runTest("idea/testData/quickfix/autoImports/factoryFunctionFromLambda.before.Main.kt"); + } + + @TestMetadata("falsePostfixOperator.before.Main.kt") + public void testFalsePostfixOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/falsePostfixOperator.before.Main.kt"); + } + + @TestMetadata("functionImport.before.Main.kt") + public void testFunctionImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/functionImport.before.Main.kt"); + } + + @TestMetadata("importAliasClassAlreadyExists.before.Main.kt") + public void testImportAliasClassAlreadyExists() throws Exception { + runTest("idea/testData/quickfix/autoImports/importAliasClassAlreadyExists.before.Main.kt"); + } + + @TestMetadata("importAliasClassAlreadyExistsCollision.before.Main.kt") + public void testImportAliasClassAlreadyExistsCollision() throws Exception { + runTest("idea/testData/quickfix/autoImports/importAliasClassAlreadyExistsCollision.before.Main.kt"); + } + + @TestMetadata("importAliasFunctionAlreadyExists.before.Main.kt") + public void testImportAliasFunctionAlreadyExists() throws Exception { + runTest("idea/testData/quickfix/autoImports/importAliasFunctionAlreadyExists.before.Main.kt"); + } + + @TestMetadata("importAliasFunctionAlreadyExistsCollision.before.Main.kt") + public void testImportAliasFunctionAlreadyExistsCollision() throws Exception { + runTest("idea/testData/quickfix/autoImports/importAliasFunctionAlreadyExistsCollision.before.Main.kt"); + } + + @TestMetadata("importAliasPropertyAlreadyExists.before.Main.kt") + public void testImportAliasPropertyAlreadyExists() throws Exception { + runTest("idea/testData/quickfix/autoImports/importAliasPropertyAlreadyExists.before.Main.kt"); + } + + @TestMetadata("importFromRoot.before.Main.kt") + public void testImportFromRoot() throws Exception { + runTest("idea/testData/quickfix/autoImports/importFromRoot.before.Main.kt"); + } + + @TestMetadata("importGetValueExtensionForDelegateWithLambda.before.Main.kt") + public void testImportGetValueExtensionForDelegateWithLambda() throws Exception { + runTest("idea/testData/quickfix/autoImports/importGetValueExtensionForDelegateWithLambda.before.Main.kt"); + } + + @TestMetadata("importInFirstPartInQualifiedExpression.before.Main.kt") + public void testImportInFirstPartInQualifiedExpression() throws Exception { + runTest("idea/testData/quickfix/autoImports/importInFirstPartInQualifiedExpression.before.Main.kt"); + } + + @TestMetadata("ImportOperatorInvokeWithConvention.before.Main.kt") + public void testImportOperatorInvokeWithConvention() throws Exception { + runTest("idea/testData/quickfix/autoImports/ImportOperatorInvokeWithConvention.before.Main.kt"); + } + + @TestMetadata("importTrait.before.Main.kt") + public void testImportTrait() throws Exception { + runTest("idea/testData/quickfix/autoImports/importTrait.before.Main.kt"); + } + + @TestMetadata("infixCall.before.Main.kt") + public void testInfixCall() throws Exception { + runTest("idea/testData/quickfix/autoImports/infixCall.before.Main.kt"); + } + + @TestMetadata("infixCall2.before.Main.kt") + public void testInfixCall2() throws Exception { + runTest("idea/testData/quickfix/autoImports/infixCall2.before.Main.kt"); + } + + @TestMetadata("iteratorOperator.before.Main.kt") + public void testIteratorOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/iteratorOperator.before.Main.kt"); + } + + @TestMetadata("memberWithTopLevelConflict.before.Main.kt") + public void testMemberWithTopLevelConflict() throws Exception { + runTest("idea/testData/quickfix/autoImports/memberWithTopLevelConflict.before.Main.kt"); + } + + @TestMetadata("minusOperator.before.Main.kt") + public void testMinusOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/minusOperator.before.Main.kt"); + } + + @TestMetadata("nestedClass.before.Main.kt") + public void testNestedClass() throws Exception { + runTest("idea/testData/quickfix/autoImports/nestedClass.before.Main.kt"); + } + + @TestMetadata("noImportForFunInQualifiedNotFirst.before.Main.kt") + public void testNoImportForFunInQualifiedNotFirst() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt"); + } + + @TestMetadata("noImportForNestedInPrivate.before.Main.kt") + public void testNoImportForNestedInPrivate() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportForNestedInPrivate.before.Main.kt"); + } + + @TestMetadata("noImportForPrivateClass.before.Main.kt") + public void testNoImportForPrivateClass() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt"); + } + + @TestMetadata("noImportInImports.before.Main.kt") + public void testNoImportInImports() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportInImports.before.Main.kt"); + } + + @TestMetadata("noImportInQualifiedExpressionNotFirst.before.Main.kt") + public void testNoImportInQualifiedExpressionNotFirst() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt"); + } + + @TestMetadata("noImportInQualifiedUserTypeNotFirst.before.Main.kt") + public void testNoImportInQualifiedUserTypeNotFirst() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportInQualifiedUserTypeNotFirst.before.Main.kt"); + } + + @TestMetadata("noImportInSafeQualifiedExpressionNotFirst.before.Main.kt") + public void testNoImportInSafeQualifiedExpressionNotFirst() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt"); + } + + @TestMetadata("noImportInterfaceRefAsConstructor.before.Main.kt") + public void testNoImportInterfaceRefAsConstructor() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportInterfaceRefAsConstructor.before.Main.kt"); + } + + @TestMetadata("noImportsForClassInExcludedPackage.before.Main.kt") + public void testNoImportsForClassInExcludedPackage() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportsForClassInExcludedPackage.before.Main.kt"); + } + + @TestMetadata("noImportsForExcludedClass.before.Main.kt") + public void testNoImportsForExcludedClass() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportsForExcludedClass.before.Main.kt"); + } + + @TestMetadata("noImportsForFunctionInExcludedPackage.before.Main.kt") + public void testNoImportsForFunctionInExcludedPackage() throws Exception { + runTest("idea/testData/quickfix/autoImports/noImportsForFunctionInExcludedPackage.before.Main.kt"); + } + + @TestMetadata("noneApplicableFromInstanceButExtension.before.Main.kt") + public void testNoneApplicableFromInstanceButExtension() throws Exception { + runTest("idea/testData/quickfix/autoImports/noneApplicableFromInstanceButExtension.before.Main.kt"); + } + + @TestMetadata("notExcludedClass.before.Main.kt") + public void testNotExcludedClass() throws Exception { + runTest("idea/testData/quickfix/autoImports/notExcludedClass.before.Main.kt"); + } + + @TestMetadata("objectImport.before.Main.kt") + public void testObjectImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/objectImport.before.Main.kt"); + } + + @TestMetadata("objectMemberFunctionImportWhenReceiverPresent.before.Main.kt") + public void testObjectMemberFunctionImportWhenReceiverPresent() throws Exception { + runTest("idea/testData/quickfix/autoImports/objectMemberFunctionImportWhenReceiverPresent.before.Main.kt"); + } + + @TestMetadata("packageClass.before.Main.kt") + public void testPackageClass() throws Exception { + runTest("idea/testData/quickfix/autoImports/packageClass.before.Main.kt"); + } + + @TestMetadata("plusOperator.before.Main.kt") + public void testPlusOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/plusOperator.before.Main.kt"); + } + + @TestMetadata("plusOperatorWithTypeMismatch.before.Main.kt") + public void testPlusOperatorWithTypeMismatch() throws Exception { + runTest("idea/testData/quickfix/autoImports/plusOperatorWithTypeMismatch.before.Main.kt"); + } + + @TestMetadata("postfixOperator.before.Main.kt") + public void testPostfixOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/postfixOperator.before.Main.kt"); + } + + @TestMetadata("propertyImport.before.Main.kt") + public void testPropertyImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/propertyImport.before.Main.kt"); + } + + @TestMetadata("sameModuleImportPriority.before.Main.kt") + public void testSameModuleImportPriority() throws Exception { + runTest("idea/testData/quickfix/autoImports/sameModuleImportPriority.before.Main.kt"); + } + + @TestMetadata("timesAssign.before.Main.kt") + public void testTimesAssign() throws Exception { + runTest("idea/testData/quickfix/autoImports/timesAssign.before.Main.kt"); + } + + @TestMetadata("typeAliasExtensionFunction.before.Main.kt") + public void testTypeAliasExtensionFunction() throws Exception { + runTest("idea/testData/quickfix/autoImports/typeAliasExtensionFunction.before.Main.kt"); + } + + @TestMetadata("typeAliasExtensionFunctionInTypeAliasChain.before.Main.kt") + public void testTypeAliasExtensionFunctionInTypeAliasChain() throws Exception { + runTest("idea/testData/quickfix/autoImports/typeAliasExtensionFunctionInTypeAliasChain.before.Main.kt"); + } + + @TestMetadata("typeAliasExtensionProperty.before.Main.kt") + public void testTypeAliasExtensionProperty() throws Exception { + runTest("idea/testData/quickfix/autoImports/typeAliasExtensionProperty.before.Main.kt"); + } + + @TestMetadata("typeAliasImport.before.Main.kt") + public void testTypeAliasImport() throws Exception { + runTest("idea/testData/quickfix/autoImports/typeAliasImport.before.Main.kt"); + } + + @TestMetadata("unaryMinusOperator.before.Main.kt") + public void testUnaryMinusOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/unaryMinusOperator.before.Main.kt"); + } + + @TestMetadata("unaryPlusOperator.before.Main.kt") + public void testUnaryPlusOperator() throws Exception { + runTest("idea/testData/quickfix/autoImports/unaryPlusOperator.before.Main.kt"); + } + + @TestMetadata("withSmartCastQualifier.before.Main.kt") + public void testWithSmartCastQualifier() throws Exception { + runTest("idea/testData/quickfix/autoImports/withSmartCastQualifier.before.Main.kt"); + } + + @TestMetadata("idea/testData/quickfix/autoImports/kt21515") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Kt21515 extends AbstractHighLevelQuickFixMultiFileTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath); + } + + public void testAllFilesPresentInKt21515() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/autoImports/kt21515"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+))$"), null, true); + } + } + + @TestMetadata("idea/testData/quickfix/autoImports/mismatchingArgs") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class MismatchingArgs extends AbstractHighLevelQuickFixMultiFileTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath); + } + + public void testAllFilesPresentInMismatchingArgs() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/autoImports/mismatchingArgs"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+))$"), null, true); + } + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt b/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt index c0efd188c53..638f8adaaf2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiFileTest.kt @@ -144,7 +144,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest val actionShouldBeAvailable = actionHint.shouldPresent() if (psiFile is KtFile) { - DirectiveBasedActionUtils.checkForUnexpectedErrors(psiFile) + checkForUnexpectedErrors(psiFile) } doAction( @@ -155,6 +155,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest getTestName(false), this::availableActions, myFixture::doHighlighting, + checkAvailableActionsAreExpected = this::checkAvailableActionsAreExpected ) val actualText = file.text @@ -221,7 +222,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest val actionShouldBeAvailable = actionHint.shouldPresent() if (psiFile is KtFile) { - DirectiveBasedActionUtils.checkForUnexpectedErrors(psiFile) + checkForUnexpectedErrors(psiFile) } doAction( @@ -232,6 +233,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest beforeFileName, this::availableActions, myFixture::doHighlighting, + checkAvailableActionsAreExpected = this::checkAvailableActionsAreExpected ) if (actionShouldBeAvailable) { @@ -273,6 +275,14 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest } } + protected open fun checkForUnexpectedErrors(file: KtFile) { + DirectiveBasedActionUtils.checkForUnexpectedErrors(file) + } + + protected open fun checkAvailableActionsAreExpected(file: PsiFile, actions: Collection) { + DirectiveBasedActionUtils.checkAvailableActionsAreExpected(file, availableActions) + } + private val availableActions: List get() { myFixture.doHighlighting() @@ -305,7 +315,9 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest testFilePath: String, getAvailableActions: () -> List, doHighlighting: () -> List, - shouldBeAvailableAfterExecution: Boolean = false + shouldBeAvailableAfterExecution: Boolean = false, + checkAvailableActionsAreExpected: (PsiFile, Collection) -> Unit = + DirectiveBasedActionUtils::checkAvailableActionsAreExpected ) { val pattern = if (text.startsWith("/")) Pattern.compile(text.substring(1, text.length - 1)) @@ -329,7 +341,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest StringUtil.join(infos, "\n") ) } else { - DirectiveBasedActionUtils.checkAvailableActionsAreExpected(file, availableActions) + checkAvailableActionsAreExpected(file, availableActions) } } else { if (!actionShouldBeAvailable) {