AbstractIdeLightClassTest: minor, refactor
This commit is contained in:
@@ -187,6 +187,7 @@ object LightClassLazinessChecker {
|
||||
}
|
||||
|
||||
// collect method class results on light members that should not trigger exact context evaluation
|
||||
val classInfo = classInfo(lightClass)
|
||||
val fieldsToInfo = lightClass.fields.asList().keysToMap { fieldInfo(it) }
|
||||
val methodsToInfo = lightClass.methods.asList().keysToMap { methodInfo(it) }
|
||||
|
||||
@@ -199,9 +200,6 @@ object LightClassLazinessChecker {
|
||||
// still running code above to catch possible exceptions
|
||||
if (lazinessMode == Mode.NoConsistency) return
|
||||
|
||||
assertEquals(lightClass.clsDelegate.methods.names(), lightClass.methods.names())
|
||||
assertEquals(lightClass.clsDelegate.fields.names(), lightClass.fields.names())
|
||||
|
||||
// check collected data against delegates which should contain correct data
|
||||
for ((field, lightFieldInfo) in fieldsToInfo) {
|
||||
val delegate = (field as KtLightField).clsDelegate
|
||||
@@ -211,9 +209,18 @@ object LightClassLazinessChecker {
|
||||
val delegate = (method as KtLightMethod).clsDelegate
|
||||
assertEquals(methodInfo(delegate), lightMethodInfo)
|
||||
}
|
||||
|
||||
assertEquals(classInfo(lightClass.clsDelegate), classInfo)
|
||||
}
|
||||
|
||||
private fun Array<out PsiMember>.names() = mapTo(LinkedHashSet()) { it.name }
|
||||
private data class ClassInfo(
|
||||
val fieldNames: Collection<String>,
|
||||
val methodNames: Collection<String>
|
||||
)
|
||||
|
||||
private fun classInfo(psiClass: PsiClass) = with(psiClass) {
|
||||
ClassInfo(fields.names(), methods.names())
|
||||
}
|
||||
|
||||
private data class FieldInfo(
|
||||
val name: String,
|
||||
@@ -240,6 +247,8 @@ object LightClassLazinessChecker {
|
||||
isConstructor, method.parameterList.parametersCount, isVarArgs
|
||||
)
|
||||
}
|
||||
|
||||
private fun Array<out PsiMember>.names() = mapTo(LinkedHashSet()) { it.name!! }
|
||||
}
|
||||
|
||||
private fun String.removeLinesStartingWith(prefix: String): String {
|
||||
|
||||
Reference in New Issue
Block a user