Minor: fix warnings in AbstractResolveByStubTest
This commit is contained in:
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user