[Gradle] Apply IDEA suggestions to BuildReportsIT.kt

This commit is contained in:
Alexander.Likhachev
2023-10-31 00:05:55 +01:00
committed by Space Team
parent 71320d2439
commit a7e3f7b3a6
@@ -96,17 +96,25 @@ class BuildReportsIT : KGPBaseTest() {
) )
@GradleTest @GradleTest
fun testBuildMetricsForJsProject(gradleVersion: GradleVersion) { fun testBuildMetricsForJsProject(gradleVersion: GradleVersion) {
testBuildReportInFile("kotlin-js-plugin-project", "compileKotlinJs", gradleVersion, testBuildReportInFile(
languageVersion = KotlinVersion.KOTLIN_1_7.version) "kotlin-js-plugin-project",
"compileKotlinJs",
gradleVersion,
languageVersion = KotlinVersion.KOTLIN_1_7.version
)
} }
private fun testBuildReportInFile(project: String, task: String, gradleVersion: GradleVersion, private fun testBuildReportInFile(
languageVersion: String = KotlinVersion.KOTLIN_2_0.version) { project: String,
task: String,
gradleVersion: GradleVersion,
languageVersion: String = KotlinVersion.KOTLIN_2_0.version,
) {
project(project, gradleVersion) { project(project, gradleVersion) {
build(task) { build(task) {
assertBuildReportPathIsPrinted() assertBuildReportPathIsPrinted()
} }
//Should contains build metrics for all compile kotlin tasks //Should contain build metrics for all compile kotlin tasks
validateBuildReportFile(KotlinVersion.DEFAULT.version) validateBuildReportFile(KotlinVersion.DEFAULT.version)
} }
@@ -114,7 +122,7 @@ class BuildReportsIT : KGPBaseTest() {
build(task, buildOptions = buildOptions.copy(languageVersion = languageVersion)) { build(task, buildOptions = buildOptions.copy(languageVersion = languageVersion)) {
assertBuildReportPathIsPrinted() assertBuildReportPathIsPrinted()
} }
//Should contains build metrics for all compile kotlin tasks //Should contain build metrics for all compile kotlin tasks
validateBuildReportFile(languageVersion) validateBuildReportFile(languageVersion)
} }
} }
@@ -330,7 +338,7 @@ class BuildReportsIT : KGPBaseTest() {
files.single().bufferedReader().use { reader -> files.single().bufferedReader().use { reader ->
val kotlinVersion = reader.readLine() val kotlinVersion = reader.readLine()
assertTrue("kotlin version should be in the error file") { assertTrue("kotlin version should be in the error file") {
kotlinVersion != null && kotlinVersion.trim().equals("kotlin version: ${buildOptions.kotlinVersion}") kotlinVersion != null && kotlinVersion.trim() == "kotlin version: ${buildOptions.kotlinVersion}"
} }
val errorMessage = reader.readLine() val errorMessage = reader.readLine()
assertTrue("Error message should start with 'error message: ' to parse it on IDEA side") { assertTrue("Error message should start with 'error message: ' to parse it on IDEA side") {