diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-08-13 18:40:34 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 18:40:34 +0530 |
commit | a82f8dda860714f446373e6c9406f13d8d6a2547 (patch) | |
tree | 1d40a286751b1ac3801c1240bfa454c84c77dc73 | |
parent | 70137f31917ba1d28d36d1557808c135828ae433 (diff) |
Disable explicit API for tests (#1483)
* build: disable explicit API for test tasks
* Remove `internal` modifier from test classes
5 files changed, 9 insertions, 6 deletions
diff --git a/autofill-parser/src/test/kotlin/mozilla/components/lib/publicsuffixlist/PublicSuffixListLoaderTest.kt b/autofill-parser/src/test/kotlin/mozilla/components/lib/publicsuffixlist/PublicSuffixListLoaderTest.kt index a4b7d4eb..b0ff0305 100644 --- a/autofill-parser/src/test/kotlin/mozilla/components/lib/publicsuffixlist/PublicSuffixListLoaderTest.kt +++ b/autofill-parser/src/test/kotlin/mozilla/components/lib/publicsuffixlist/PublicSuffixListLoaderTest.kt @@ -7,7 +7,7 @@ package mozilla.components.lib.publicsuffixlist import org.junit.Test -internal class PublicSuffixListLoaderTest { +class PublicSuffixListLoaderTest { @Test fun testLoadingBundledPublicSuffixList() { requireNotNull(javaClass.classLoader).getResourceAsStream("publicsuffixes").buffered().use { diff --git a/buildSrc/src/main/java/PasswordStorePlugin.kt b/buildSrc/src/main/java/PasswordStorePlugin.kt index df491e0d..52641526 100644 --- a/buildSrc/src/main/java/PasswordStorePlugin.kt +++ b/buildSrc/src/main/java/PasswordStorePlugin.kt @@ -68,9 +68,12 @@ class PasswordStorePlugin : Plugin<Project> { } private fun Project.configureExplicitApi() { - configure<KotlinProjectExtension> { explicitApi() } + val project = this tasks.withType<KotlinCompile> { - kotlinOptions { freeCompilerArgs = freeCompilerArgs + listOf("-Xexplicit-api=strict") } + if (!name.contains("test", ignoreCase = true)) { + project.configure<KotlinProjectExtension> { explicitApi() } + kotlinOptions { freeCompilerArgs += listOf("-Xexplicit-api=strict") } + } } } } diff --git a/format-common/src/test/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntryTest.kt b/format-common/src/test/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntryTest.kt index df4dc42e..5479c6db 100644 --- a/format-common/src/test/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntryTest.kt +++ b/format-common/src/test/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntryTest.kt @@ -18,7 +18,7 @@ import kotlinx.coroutines.test.TestCoroutineScope import org.junit.Test @OptIn(ExperimentalCoroutinesApi::class, ExperimentalTime::class) -internal class PasswordEntryTest { +class PasswordEntryTest { private fun makeEntry(content: String) = PasswordEntry(fakeClock, testFinder, testScope, content.encodeToByteArray()) diff --git a/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt b/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt index d75cc900..5098bec9 100644 --- a/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt +++ b/format-common/src/test/kotlin/dev/msfjarvis/aps/util/time/TestClocks.kt @@ -13,7 +13,7 @@ import java.time.ZoneOffset.UTC /** * Implementation of [UserClock] that is fixed to [Instant.EPOCH] for deterministic time-based tests */ -internal class TestUserClock(instant: Instant) : UserClock() { +class TestUserClock(instant: Instant) : UserClock() { constructor() : this(Instant.EPOCH) diff --git a/format-common/src/test/kotlin/dev/msfjarvis/aps/util/totp/OtpTest.kt b/format-common/src/test/kotlin/dev/msfjarvis/aps/util/totp/OtpTest.kt index a2de94d8..bff7af1e 100644 --- a/format-common/src/test/kotlin/dev/msfjarvis/aps/util/totp/OtpTest.kt +++ b/format-common/src/test/kotlin/dev/msfjarvis/aps/util/totp/OtpTest.kt @@ -11,7 +11,7 @@ import kotlin.test.assertNotNull import kotlin.test.assertNull import org.junit.Test -internal class OtpTest { +class OtpTest { private fun generateOtp( counter: Long, |