[LL FIR] add test which checks reference shortening for the whole file

^KT-57966
This commit is contained in:
Ilya Kirillov
2023-04-26 18:33:37 +02:00
committed by Space Team
parent bb7037aa8e
commit e9f75b1350
8 changed files with 188 additions and 20 deletions
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2022 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.analysis.api.impl.base.test.cases.references
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.ShorteningResultsRenderer.renderShorteningResults
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedSingleModuleTest
import org.jetbrains.kotlin.analysis.test.framework.utils.executeOnPooledThreadInReadAction
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
abstract class AbstractReferenceShortenerForWholeFileTest : AbstractAnalysisApiBasedSingleModuleTest() {
override fun doTestByFileStructure(ktFiles: List<KtFile>, module: TestModule, testServices: TestServices) {
val file = ktFiles.first()
val shortening = executeOnPooledThreadInReadAction {
analyseForTest(file.declarations.first()) {
collectPossibleReferenceShortenings(file)
}
}
val actual = buildString {
renderShorteningResults(shortening)
}
testServices.assertions.assertEqualsToTestDataFileSibling(actual)
}
}