Skip to content

Commit

Permalink
Run LithoHookUsageCheckerTest in both K1 and K2 modes
Browse files Browse the repository at this point in the history
Summary: Make LithoHookUsageCheckerTest parameterized to suppose both K1 and K2 modes

Reviewed By: zielinskimz

Differential Revision: D65447521

fbshipit-source-id: 82171fa56353877c93d1624941b4c883f4c5ec5e
  • Loading branch information
kingsleyadio authored and facebook-github-bot committed Nov 14, 2024
1 parent 3c1e024 commit e5c55a7
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`() {
Expand Down Expand Up @@ -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)
}
}

0 comments on commit e5c55a7

Please sign in to comment.