Skip to content

Commit

Permalink
Add test to confirm that generated code has proper visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
joshafeinberg committed Nov 15, 2024
1 parent 018c9a1 commit 1cb4ebf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
testImplementation libs.assertk
testImplementation libs.kotlin.compile.testing.core
testImplementation libs.kotlin.compile.testing.ksp
testImplementation libs.kotlin.reflect

testImplementation platform(libs.junit.jupiter.bom)
testImplementation libs.junit.jupiter.core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import software.amazon.lastmile.kotlin.inject.anvil.newComponent
import java.lang.reflect.Field
import java.lang.reflect.Method
import kotlin.reflect.KClass
import kotlin.reflect.KVisibility

class GenerateKotlinInjectComponentProcessorTest {

Expand Down Expand Up @@ -265,6 +266,7 @@ class GenerateKotlinInjectComponentProcessorTest {
) {
val component = componentInterface.kotlinInjectComponent.newComponent<Any>()

assertThat(component::class.visibility).isEqualTo(KVisibility.INTERNAL)
assertThat(component::class.companionObject).isNotNull()
}
}
Expand All @@ -287,6 +289,7 @@ class GenerateKotlinInjectComponentProcessorTest {
) {
val component = componentInterface.kotlinInjectComponent.newComponent<Any>()

assertThat(component::class.visibility).isEqualTo(KVisibility.INTERNAL)
assertThat(component::class.companionObject).isNotNull()
}
}
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
kotlinx-binaryCompatibilityValidator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "kotlinx-binaryCompatibilityValidator" }
kotlin-poet = { module = "com.squareup:kotlinpoet", version.ref = "kotlin-poet" }
kotlin-poet-ksp = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
ksp-gradle-plugin = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" }
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
Expand Down

0 comments on commit 1cb4ebf

Please sign in to comment.