Disable explicit API for tests (#1483)

* build: disable explicit API for test tasks

* Remove `internal` modifier from test classes
This commit is contained in:
Harsh Shandilya
2021-08-13 18:40:34 +05:30
committed by GitHub
parent 70137f3191
commit a82f8dda86
5 changed files with 9 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ package mozilla.components.lib.publicsuffixlist
import org.junit.Test import org.junit.Test
internal class PublicSuffixListLoaderTest { class PublicSuffixListLoaderTest {
@Test @Test
fun testLoadingBundledPublicSuffixList() { fun testLoadingBundledPublicSuffixList() {
requireNotNull(javaClass.classLoader).getResourceAsStream("publicsuffixes").buffered().use { requireNotNull(javaClass.classLoader).getResourceAsStream("publicsuffixes").buffered().use {

View File

@@ -68,9 +68,12 @@ class PasswordStorePlugin : Plugin<Project> {
} }
private fun Project.configureExplicitApi() { private fun Project.configureExplicitApi() {
configure<KotlinProjectExtension> { explicitApi() } val project = this
tasks.withType<KotlinCompile> { 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") }
}
} }
} }
} }

View File

@@ -18,7 +18,7 @@ import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.Test import org.junit.Test
@OptIn(ExperimentalCoroutinesApi::class, ExperimentalTime::class) @OptIn(ExperimentalCoroutinesApi::class, ExperimentalTime::class)
internal class PasswordEntryTest { class PasswordEntryTest {
private fun makeEntry(content: String) = private fun makeEntry(content: String) =
PasswordEntry(fakeClock, testFinder, testScope, content.encodeToByteArray()) PasswordEntry(fakeClock, testFinder, testScope, content.encodeToByteArray())

View File

@@ -13,7 +13,7 @@ import java.time.ZoneOffset.UTC
/** /**
* Implementation of [UserClock] that is fixed to [Instant.EPOCH] for deterministic time-based tests * 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) constructor() : this(Instant.EPOCH)

View File

@@ -11,7 +11,7 @@ import kotlin.test.assertNotNull
import kotlin.test.assertNull import kotlin.test.assertNull
import org.junit.Test import org.junit.Test
internal class OtpTest { class OtpTest {
private fun generateOtp( private fun generateOtp(
counter: Long, counter: Long,