[jvm] Properly enable K2 mode for K2 tests

Also ignores any failing tests

GitOrigin-RevId: db34ca3d4690285cd7ed4186c76f31e81e7fab46
This commit is contained in:
Bart van Helvert
2024-09-11 18:08:14 +02:00
committed by intellij-monorepo-bot
parent 689dd2e194
commit c8c478bdbc
63 changed files with 296 additions and 9 deletions

View File

@@ -4,8 +4,13 @@ import com.intellij.analysis.JvmAnalysisBundle
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingConditionDisagreesWithLogLevelStatementInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingConditionDisagreesWithLogLevelStatementInspectionTest : LoggingConditionDisagreesWithLogLevelStatementInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test slf4j`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """
import org.slf4j.LoggerFactory

View File

@@ -4,8 +4,13 @@ import com.intellij.analysis.JvmAnalysisBundle
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingGuardedByConditionInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingGuardedByConditionInspectionTest : LoggingGuardedByConditionInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test slf4j`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """
import org.slf4j.Logger

View File

@@ -3,8 +3,13 @@ package com.intellij.codeInspection.tests.kotlin.logging
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingPlaceholderCountMatchesArgumentCountInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingPlaceholderCountMatchesArgumentCountInspectionLog4J2Test : LoggingPlaceholderCountMatchesArgumentCountInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test log4j2 with text variables`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """
import org.apache.logging.log4j.LogManager

View File

@@ -4,8 +4,13 @@ import com.intellij.codeInspection.logging.LoggingPlaceholderCountMatchesArgumen
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingPlaceholderCountMatchesArgumentCountInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingPlaceholderCountMatchesArgumentCountInspectionPlaceholderNumberTest : LoggingPlaceholderCountMatchesArgumentCountInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test many variables`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """
import org.slf4j.LoggerFactory

View File

@@ -4,8 +4,13 @@ import com.intellij.codeInspection.logging.LoggingPlaceholderCountMatchesArgumen
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingPlaceholderCountMatchesArgumentCountInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingPlaceholderCountMatchesArgumentCountInspectionSlf4JTest : LoggingPlaceholderCountMatchesArgumentCountInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test slf4j disable slf4jToLog4J2Type`() {
inspection.slf4jToLog4J2Type = LoggingPlaceholderCountMatchesArgumentCountInspection.Slf4jToLog4J2Type.NO
myFixture.testHighlighting(JvmLanguage.KOTLIN, """

View File

@@ -3,8 +3,12 @@ package com.intellij.codeInspection.tests.kotlin.logging
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingSimilarMessageInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingSimilarMessageInspectionTest : LoggingSimilarMessageInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test equals log4j2`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """

View File

@@ -4,8 +4,13 @@ import com.intellij.analysis.JvmAnalysisBundle
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingStatementNotGuardedByLogConditionInspectionTestBase
import com.intellij.jvm.analysis.testFramework.JvmLanguage
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
abstract class KotlinLoggingStatementNotGuardedByLogConditionInspectionTest : LoggingStatementNotGuardedByLogConditionInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
fun `test slf4j`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """
import org.slf4j.Logger

View File

@@ -6,11 +6,16 @@ import com.intellij.jvm.analysis.KotlinJvmAnalysisTestUtil
import com.intellij.jvm.analysis.internal.testFramework.logging.LoggingStringTemplateAsArgumentInspectionTestBase
import com.intellij.testFramework.TestDataPath
import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider
import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin
private const val INSPECTION_PATH = "/codeInspection/logging/stringTemplateAsArgument"
@TestDataPath("\$CONTENT_ROOT/testData$INSPECTION_PATH")
abstract class KotlinLoggingStringTemplateAsArgumentInspectionTest : LoggingStringTemplateAsArgumentInspectionTestBase(), ExpectedPluginModeProvider {
override fun setUp() {
setUpWithKotlinPlugin(testRootDisposable) { super.setUp() }
}
override val inspection: LoggingStringTemplateAsArgumentInspection = LoggingStringTemplateAsArgumentInspection().apply {
myLimitLevelType = LoggingUtil.LimitLevelType.ALL
}