From 80b5c76d98c7ac9704110e135e9d96df46ff4ad4 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 5 Sep 2019 17:40:20 +0300 Subject: [PATCH] Minor: fix warnings in AbstractResolveByStubTest --- .../idea/stubs/AbstractResolveByStubTest.kt | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractResolveByStubTest.kt b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractResolveByStubTest.kt index 557d25156b0..6f8ae2f81e4 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractResolveByStubTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractResolveByStubTest.kt @@ -21,26 +21,22 @@ import java.io.File abstract class AbstractResolveByStubTest : KotlinLightCodeInsightFixtureTestCase() { protected fun doTest(testFileName: String) { - doTest(testFileName, true, true) - } - - override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - - private fun doTest(path: String, checkPrimaryConstructors: Boolean, checkPropertyAccessors: Boolean) { - if (InTextDirectivesUtils.isDirectiveDefined(File(path).readText(), "NO_CHECK_SOURCE_VS_BINARY")) { + if (InTextDirectivesUtils.isDirectiveDefined(File(testFileName).readText(), "NO_CHECK_SOURCE_VS_BINARY")) { // If NO_CHECK_SOURCE_VS_BINARY is enabled, source vs binary descriptors differ, which means that we should not run this test: // it would compare descriptors resolved from sources (by stubs) with .txt, which describes binary descriptors return } - myFixture.configureByFile(path) + myFixture.configureByFile(testFileName) val shouldFail = getTestName(false) == "ClassWithConstVal" AstAccessControl.testWithControlledAccessToAst(shouldFail, project, testRootDisposable) { - performTest(path, checkPrimaryConstructors, checkPropertyAccessors) + performTest(testFileName) } } - private fun performTest(path: String, checkPrimaryConstructors: Boolean, checkPropertyAccessors: Boolean) { + override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE + + private fun performTest(path: String) { val file = file as KtFile val module = file.findModuleDescriptor() val packageViewDescriptor = module.getPackage(FqName("test")) @@ -49,13 +45,13 @@ abstract class AbstractResolveByStubTest : KotlinLightCodeInsightFixtureTestCase val fileToCompareTo = File(FileUtil.getNameWithoutExtension(path) + ".txt") RecursiveDescriptorComparator.validateAndCompareDescriptorWithFile( - packageViewDescriptor, - RecursiveDescriptorComparator.DONT_INCLUDE_METHODS_OF_OBJECT - .filterRecursion(RecursiveDescriptorComparator.SKIP_BUILT_INS_PACKAGES) - .checkPrimaryConstructors(checkPrimaryConstructors) - .checkPropertyAccessors(checkPropertyAccessors) - .withValidationStrategy(errorTypesForbidden()), - fileToCompareTo + packageViewDescriptor, + RecursiveDescriptorComparator.DONT_INCLUDE_METHODS_OF_OBJECT + .filterRecursion(RecursiveDescriptorComparator.SKIP_BUILT_INS_PACKAGES) + .checkPrimaryConstructors(true) + .checkPropertyAccessors(true) + .withValidationStrategy(errorTypesForbidden()), + fileToCompareTo ) } }