Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
...gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/MppTestsIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.kotlin.gradle.mpp | ||
|
||
import org.gradle.api.logging.configuration.WarningMode | ||
import org.gradle.util.GradleVersion | ||
import org.jetbrains.kotlin.gradle.native.MPPNativeTargets | ||
import org.jetbrains.kotlin.gradle.testbase.* | ||
import org.junit.jupiter.api.DisplayName | ||
|
||
@MppGradlePluginTests | ||
@DisplayName("Tests for multiplatform testing") | ||
class MppTestsIT : KGPBaseTest() { | ||
@DisplayName("KT-54634: MPP testing logic is compatible with API changes in Gradle 7.6") | ||
// TODO: move 7.6 version to additional versions once max supported version will be 7.6 or higher | ||
@GradleTestVersions(maxVersion = TestVersions.Gradle.G_7_6, additionalVersions = [TestVersions.Gradle.G_7_5]) | ||
@GradleTest | ||
fun testKt54634(gradleVersion: GradleVersion) { | ||
project( | ||
"new-mpp-lib-with-tests", | ||
gradleVersion, | ||
buildOptions = defaultBuildOptions.copy( | ||
warningMode = WarningMode.None, // some APIs were deprecated, remove this later | ||
freeArgs = listOf("--continue"), // to ensure that all the tests are run | ||
) | ||
) { | ||
val nativeTarget = MPPNativeTargets.current | ||
|
||
build(":allTests") { | ||
assertTasksExecuted( | ||
":jsNodeTest", | ||
":jvmWithoutJavaTest", | ||
":${nativeTarget}Test" | ||
) | ||
} | ||
|
||
// break all the test tasks | ||
kotlinSourcesDir("commonTest").resolve("TestCommonCode.kt").modify { | ||
it.replace("expectedFun()", "assertEquals(0, 1)") | ||
} | ||
buildAndFail(":allTests") { | ||
assertTasksFailed( | ||
":jsNodeTest", | ||
":jvmWithoutJavaTest", | ||
":${nativeTarget}Test" | ||
) | ||
assertOutputDoesNotContain("does not define or inherit an implementation of the resolved method") | ||
assertOutputDoesNotContain("NoSuchMethodError") | ||
assertOutputContainsExactlyTimes("AssertionError:", 3) | ||
} | ||
} | ||
} | ||
} |