[kotlin] fix tests after migration to ModCommand API

After migration "Make 'open'" intention is available for local declaration and suggests adding modifier to containing non-local declaration
KTIJ-26974

GitOrigin-RevId: 250517cce4ad91aeb25b8335585acaba157b2f49
This commit is contained in:
aleksandrina-streltsova
2023-10-13 12:53:30 +00:00
committed by intellij-monorepo-bot
parent 7b86113420
commit ed6e25b59d
8 changed files with 36 additions and 3 deletions
@@ -21,6 +21,13 @@ abstract class AbstractK2IntentionTest : AbstractIntentionTestBase() {
else super.afterFileNameSuffix(ktFilePath)
}
override fun fileName(): String {
val fileName = super.fileName()
val firFileName = IgnoreTests.deriveFirFileName(fileName)
return if (File(testDataDirectory, firFileName).exists()) firFileName else fileName
}
override fun isFirPlugin() = true
override fun getDefaultProjectDescriptor(): KotlinLightProjectDescriptor {
@@ -339,6 +339,8 @@ object IgnoreTests {
private fun deriveFirTestFile(originalTestFile: File): File {
val name = originalTestFile.name
return originalTestFile.parentFile.resolve(name.substringBeforeLast('.') + ".fir." + name.substringAfterLast('.'))
return originalTestFile.parentFile.resolve(deriveFirFileName(name))
}
fun deriveFirFileName(fileName: String): String = fileName.substringBeforeLast('.') + ".fir." + fileName.substringAfterLast('.')
}
@@ -0,0 +1,7 @@
open class Foo {
fun bar() {
fun<caret> foo() {
}
}
}
@@ -0,0 +1,7 @@
open class Foo {
open fun bar() {
fun foo() {
}
}
}
@@ -1,5 +1,4 @@
// IS_APPLICABLE: false
open class Foo {
fun bar() {
fun <caret> foo() {
@@ -0,0 +1,6 @@
// AFTER-WARNING: Variable 'foo' is never used
open class Foo {
fun bar() {
var<caret> foo = 1
}
}
@@ -0,0 +1,6 @@
// AFTER-WARNING: Variable 'foo' is never used
open class Foo {
open fun bar() {
var foo = 1
}
}
@@ -1,5 +1,4 @@
// IS_APPLICABLE: false
open class Foo {
fun bar() {
var<caret> foo = 1