FIR IDE: use different .after testdata for AbstractHLIntentionTest.kt

This commit is contained in:
Ilya Kirillov
2021-02-19 14:33:11 +01:00
parent 42103b7363
commit 141b6b0e55
8 changed files with 52 additions and 3 deletions
@@ -12,6 +12,12 @@ import java.io.File
abstract class AbstractHLIntentionTest : AbstractIntentionTest() {
override fun intentionFileName() = ".firIntention"
override fun afterFileNameSuffix(ktFilePath: File): String {
return if (ktFilePath.resolveSibling(ktFilePath.name + AFTER_FIR_EXTENSION).exists()) AFTER_FIR_EXTENSION
else super.afterFileNameSuffix(ktFilePath)
}
override fun isFirPlugin() = true
override fun doTestFor(mainFile: File, pathToFiles: Map<String, PsiFile>, intentionAction: IntentionAction, fileText: String) {
@@ -22,4 +28,8 @@ abstract class AbstractHLIntentionTest : AbstractIntentionTest() {
override fun checkForErrorsAfter(fileText: String) {}
override fun checkForErrorsBefore(fileText: String) {}
companion object {
private const val AFTER_FIR_EXTENSION = ".after.fir"
}
}
@@ -0,0 +1,9 @@
class A<T>
class B<T>
class C<T>
class D<K, V>
class E
private fun test(): () -> C<out D<out A<out Any>, out B<out D<out Any, A<E>>>>> = {
class Local
C<D<A<Local>, B<D<Local, A<E>>>>>()
}
@@ -0,0 +1,6 @@
class F
class TestClass<V, K>
private fun test(): () -> TestClass<F, out Any> = {
class Local
TestClass<F, Local>()
}
@@ -0,0 +1,5 @@
class TestClass<T>
private fun test(): () -> TestClass<out Any> = {
class Local
TestClass<Local>()
}
@@ -0,0 +1,8 @@
open class F
class B<out T>
class K<T>
private fun check(): () -> B<K<out F>> = {
class Local : F()
B<K<Local>>()
}
@@ -0,0 +1,8 @@
open class F
class B<T>
class K<out T>
private fun check(): () -> B<out K<F>> = {
class Local : F()
B<K<Local>>()
}
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.Assert
import java.io.File
import java.nio.file.Path
import java.util.*
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
@@ -39,7 +40,7 @@ import java.util.concurrent.TimeUnit
abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() {
protected open fun intentionFileName(): String = ".intention"
protected open fun afterFileNameSuffix(): String = ".after"
protected open fun afterFileNameSuffix(ktFilePath: File): String = ".after"
protected open fun isApplicableDirectiveName(): String = "IS_APPLICABLE"
@@ -193,7 +194,7 @@ abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() {
// Don't bother checking if it should have failed.
if (shouldFailString.isEmpty()) {
for ((filePath, value) in pathToFiles) {
val canonicalPathToExpectedFile = filePath + afterFileNameSuffix()
val canonicalPathToExpectedFile = filePath + afterFileNameSuffix(mainFile)
if (filePath == mainFilePath) {
try {
myFixture.checkResultByFile(canonicalPathToExpectedFile)
@@ -5,9 +5,11 @@
package org.jetbrains.kotlin.idea.intentions
import java.io.File
abstract class AbstractIntentionTest2 : AbstractIntentionTest() {
override fun intentionFileName() = ".intention2"
override fun afterFileNameSuffix() = ".after2"
override fun afterFileNameSuffix(ktFilePath: File) = ".after2"
override fun intentionTextDirectiveName() = "INTENTION_TEXT_2"
override fun isApplicableDirectiveName() = "IS_APPLICABLE_2"
}