From e5c55a7b829b1b6ef4df51d624cb37a3b8e510de Mon Sep 17 00:00:00 2001 From: Kingsley Adio Date: Thu, 14 Nov 2024 04:57:31 -0800 Subject: [PATCH] Run LithoHookUsageCheckerTest in both K1 and K2 modes Summary: Make LithoHookUsageCheckerTest parameterized to suppose both K1 and K2 modes Reviewed By: zielinskimz Differential Revision: D65447521 fbshipit-source-id: 82171fa56353877c93d1624941b4c883f4c5ec5e --- .../litho/diagnostics/LithoHookUsageCheckerTest.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/litho-compiler-plugin/compiler/src/test/kotlin/com/facebook/litho/diagnostics/LithoHookUsageCheckerTest.kt b/litho-compiler-plugin/compiler/src/test/kotlin/com/facebook/litho/diagnostics/LithoHookUsageCheckerTest.kt index e778d1247f..7051ccfdff 100644 --- a/litho-compiler-plugin/compiler/src/test/kotlin/com/facebook/litho/diagnostics/LithoHookUsageCheckerTest.kt +++ b/litho-compiler-plugin/compiler/src/test/kotlin/com/facebook/litho/diagnostics/LithoHookUsageCheckerTest.kt @@ -24,9 +24,17 @@ import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized +import org.junit.runners.Parameterized.Parameters @OptIn(ExperimentalCompilerApi::class) -class LithoHookUsageCheckerTest : AbstractCompilerTest() { +@RunWith(Parameterized::class) +class LithoHookUsageCheckerTest(private val useK2: Boolean) : AbstractCompilerTest() { + + companion object { + @Parameters(name = "useK2={0}") @JvmStatic fun useK2() = listOf(false, true) + } @Test fun `doesn't complain about hook used in render function`() { @@ -312,6 +320,6 @@ class LithoHookUsageCheckerTest : AbstractCompilerTest() { } private fun compile(@Language("kotlin") source: String): CompilationResult { - return compile(SourceFile.kotlin("TestClass.kt", source)) + return compile(SourceFile.kotlin("TestClass.kt", source), useK2 = useK2) } }