Change Gradle test expectations after KT-61969
This commit is contained in:
committed by
Space Team
parent
653fc03cbc
commit
b0bee09948
+3
-1
@@ -283,7 +283,9 @@ open class HierarchicalMppIT : KGPBaseTest() {
|
||||
"kotlin-stdlib-${buildOptions.kotlinVersion}-all.jar",
|
||||
"kotlin-dom-api-compat-${buildOptions.kotlinVersion}.klib",
|
||||
"kotlin-stdlib-js-${buildOptions.kotlinVersion}.klib",
|
||||
"kotlin-test-${buildOptions.kotlinVersion}-all.jar",
|
||||
"kotlin-test-js-${buildOptions.kotlinVersion}.klib",
|
||||
"kotlin-test-junit-${buildOptions.kotlinVersion}.jar",
|
||||
).toSortedSet(),
|
||||
transformedArtifacts().toSortedSet()
|
||||
)
|
||||
@@ -720,7 +722,7 @@ open class HierarchicalMppIT : KGPBaseTest() {
|
||||
publishThirdPartyLib(withGranularMetadata = true, gradleVersion = gradleVersion, localRepoDir = tempDir)
|
||||
|
||||
subProject("my-lib-foo").buildGradleKts
|
||||
.appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test-annotations-common\")) }")
|
||||
.appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test\")) }")
|
||||
projectPath.resolve("my-lib-foo/src/jvmAndJsMain/kotlin/UseCompileOnlyDependency.kt").writeText(
|
||||
"""
|
||||
import kotlin.test.Test
|
||||
|
||||
+19
-16
@@ -20,8 +20,7 @@ import kotlin.io.path.createDirectories
|
||||
import kotlin.io.path.writeText
|
||||
import kotlin.streams.asStream
|
||||
import kotlin.streams.toList
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
import kotlin.test.fail
|
||||
|
||||
@DisplayName("Kotlin default dependencies")
|
||||
class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
||||
@@ -422,7 +421,7 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
||||
project("simpleProject", gradleVersion) {
|
||||
assertKotlinTestDependency(
|
||||
listOf("testImplementation"),
|
||||
mapOf("compileTestKotlin" to listOf("kotlin-test-testng"))
|
||||
mapOf("compileTestKotlin" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}.jar", "kotlin-test-testng"))
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -451,18 +450,18 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
||||
assertKotlinTestDependency(
|
||||
listOf("commonTestImplementation"),
|
||||
mapOf(
|
||||
"compileTestKotlinJvm" to listOf("kotlin-test-junit"),
|
||||
"compileTestKotlinJvm" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}.jar", "kotlin-test-junit"),
|
||||
"compileTestKotlinJs" to listOf("kotlin-test-js")
|
||||
),
|
||||
mapOf(
|
||||
"commonTestImplementationDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
||||
"commonTestImplementationDependenciesMetadata" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
|
||||
/*
|
||||
implementation, api and compileOnly scoped metadata configurations are deprecated and report the same dependencies.
|
||||
The IDE does not rely on which exact configuration returned the dependencies.
|
||||
*/
|
||||
"commonTestApiDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
||||
"commonTestCompileOnlyDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
||||
"commonTestApiDependenciesMetadata" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
"commonTestCompileOnlyDependenciesMetadata" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
),
|
||||
isBuildGradleKts = true
|
||||
)
|
||||
@@ -477,14 +476,14 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
||||
assertKotlinTestDependency(
|
||||
listOf("jvmAndJsTestApi", "jvmAndJsTestCompileOnly"), // add to the intermediate source set, and to two scopes
|
||||
mapOf(
|
||||
"compileTestKotlinJvm" to listOf("kotlin-test-junit"),
|
||||
"compileTestKotlinJvm" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}.jar", "kotlin-test-junit"),
|
||||
"compileTestKotlinJs" to listOf("kotlin-test-js")
|
||||
),
|
||||
mapOf(
|
||||
"commonTestApiDependenciesMetadata" to listOf("!kotlin-test-common"),
|
||||
"commonTestCompileOnlyDependenciesMetadata" to listOf("!kotlin-test-common"),
|
||||
"jvmAndJsTestApiDependenciesMetadata" to listOf("kotlin-test-common"),
|
||||
"jvmAndJsTestCompileOnlyDependenciesMetadata" to listOf("kotlin-test-common"),
|
||||
"commonTestApiDependenciesMetadata" to listOf("!kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
"commonTestCompileOnlyDependenciesMetadata" to listOf("!kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
"jvmAndJsTestApiDependenciesMetadata" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
"jvmAndJsTestCompileOnlyDependenciesMetadata" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}-all"),
|
||||
),
|
||||
isBuildGradleKts = true
|
||||
)
|
||||
@@ -499,10 +498,10 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
||||
assertKotlinTestDependency(
|
||||
listOf("commonTestImplementation"),
|
||||
mapOf(
|
||||
"compileTestKotlinJvm" to listOf("kotlin-test-junit"),
|
||||
"compileTestKotlinJvm" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}.jar", "kotlin-test-junit"),
|
||||
),
|
||||
mapOf(
|
||||
"commonTestImplementationDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common")
|
||||
"commonTestImplementationDependenciesMetadata" to listOf("kotlin-test-${defaultBuildOptions.kotlinVersion}-all")
|
||||
),
|
||||
isBuildGradleKts = true
|
||||
)
|
||||
@@ -759,10 +758,14 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
||||
val itemsLine = output.lines().single { "###$printingTaskName" in it }.substringAfter(printingTaskName)
|
||||
val items = itemsLine.removeSurrounding("[", "]").split(", ").toSet()
|
||||
checkAnyItemsContains.forEach { pattern ->
|
||||
assertTrue("Dependencies($dependencyOwner) does not contain $pattern") { items.any { pattern in it } }
|
||||
if (!items.any { pattern in it }) {
|
||||
fail("Dependencies($dependencyOwner) does not contain $pattern\nDependencies:\n${items.joinToString("\n")}")
|
||||
}
|
||||
}
|
||||
checkNoItemContains.forEach { pattern ->
|
||||
assertFalse("Dependencies($dependencyOwner) unexpectedly contains $pattern") { items.any { pattern in it } }
|
||||
if (items.any { pattern in it }) {
|
||||
fail("Dependencies($dependencyOwner) unexpectedly contains $pattern\nDependencies:\n${items.joinToString("\n")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -24,6 +24,7 @@ class IdeOriginalMetadataDependencyResolverTest {
|
||||
|
||||
@Test
|
||||
fun `test kotlin-test-common`() {
|
||||
val lastLegacyMetadataKotlinTestVersion = "1.9.20"
|
||||
val project = buildProject {
|
||||
enableDependencyVerification(false)
|
||||
enableDefaultStdlibDependency(false)
|
||||
@@ -39,13 +40,13 @@ class IdeOriginalMetadataDependencyResolverTest {
|
||||
kotlin.linuxArm64()
|
||||
|
||||
kotlin.sourceSets.commonTest.dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-test-common:${kotlin.coreLibrariesVersion}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-test-common:$lastLegacyMetadataKotlinTestVersion")
|
||||
}
|
||||
|
||||
project.evaluate()
|
||||
|
||||
IdeOriginalMetadataDependencyResolver.resolve(kotlin.sourceSets.commonTest.get()).assertMatches(
|
||||
binaryCoordinates("org.jetbrains.kotlin:kotlin-test-common:${kotlin.coreLibrariesVersion}")
|
||||
binaryCoordinates("org.jetbrains.kotlin:kotlin-test-common:$lastLegacyMetadataKotlinTestVersion")
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user