Skip to content

Commit

Permalink
[Gradle] Add test for KT-54634
Browse files Browse the repository at this point in the history
(cherry picked from commit 857f704)
  • Loading branch information
ALikhachev committed Dec 2, 2022
1 parent 6a38752 commit 5b4c796
Showing 1 changed file with 56 additions and 0 deletions.
@@ -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)
}
}
}
}

0 comments on commit 5b4c796

Please sign in to comment.