Skip to content

Commit 16e93e6

Browse files
committed
add more tests
1 parent 1a12a38 commit 16e93e6

File tree

1 file changed

+26
-1
lines changed
  • sentry-kotlin-multiplatform-gradle-plugin/src/test/java/io/sentry/kotlin/multiplatform/gradle

1 file changed

+26
-1
lines changed

sentry-kotlin-multiplatform-gradle-plugin/src/test/java/io/sentry/kotlin/multiplatform/gradle/SentryPluginTest.kt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import org.junit.jupiter.api.Assertions.assertNull
1212
import org.junit.jupiter.api.Assertions.assertTrue
1313
import org.junit.jupiter.api.Test
1414
import org.junit.jupiter.api.io.TempDir
15+
import org.junit.jupiter.params.ParameterizedTest
16+
import org.junit.jupiter.params.provider.ValueSource
1517
import java.io.File
1618

1719
class SentryPluginTest {
@@ -80,8 +82,31 @@ class SentryPluginTest {
8082
val project = ProjectBuilder.builder().build()
8183
project.pluginManager.apply("io.sentry.kotlin.multiplatform.gradle")
8284

85+
val sourceSetAutoInstallExtension = project.extensions.getByName("commonMain") as SourceSetAutoInstallExtension
86+
assertEquals(BuildConfig.SentryKmpVersion, sourceSetAutoInstallExtension.sentryKmpVersion.get())
87+
}
88+
89+
@Test
90+
fun `custom kmp version overrides default in commonMain extension`() {
91+
val project = ProjectBuilder.builder().build()
92+
project.pluginManager.apply("io.sentry.kotlin.multiplatform.gradle")
93+
94+
val autoInstallExtension = project.extensions.getByName("autoInstall") as AutoInstallExtension
95+
autoInstallExtension.commonMain.sentryKmpVersion.set("1.2.3")
96+
97+
assertEquals("1.2.3", autoInstallExtension.commonMain.sentryKmpVersion.get())
98+
}
99+
100+
@ParameterizedTest
101+
@ValueSource(strings = ["1.0.0", "2.3.4-SNAPSHOT", "latest.release"])
102+
fun `sentryKmpVersion accepts various version formats in commonMain extension`(version: String) {
103+
val project = ProjectBuilder.builder().build()
104+
project.pluginManager.apply("io.sentry.kotlin.multiplatform.gradle")
105+
83106
val autoInstallExtension = project.extensions.getByName("autoInstall") as AutoInstallExtension
84-
assertEquals(BuildConfig.SentryKmpVersion, autoInstallExtension.commonMain.sentryKmpVersion.get())
107+
autoInstallExtension.commonMain.sentryKmpVersion.set(version)
108+
109+
assertEquals(version, autoInstallExtension.commonMain.sentryKmpVersion.get())
85110
}
86111

87112
@Test

0 commit comments

Comments
 (0)