Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import okio.buffer

import kotlin.test.Test
import kotlin.test.assertTrue
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromString

@Suppress(
"TOO_LONG_FUNCTION",
"INLINE_CLASS_CAN_BE_USED",
"MISSING_KDOC_TOP_LEVEL",
"MISSING_KDOC_CLASS_ELEMENTS"
"MISSING_KDOC_CLASS_ELEMENTS",
"ComplexMethod",
)
@OptIn(ExperimentalSerializationApi::class)
class GeneralTest {
private val fs = FileSystem.SYSTEM

Expand Down Expand Up @@ -98,9 +97,18 @@ class GeneralTest {
// FixMe: if we will have other failing tests - we will make the logic less hardcoded
result.resources.test.name != "GarbageTest.kt" &&
result.resources.test.name != "ThisShouldAlwaysFailTest.kt" &&
!result.resources.test.toString().contains("warn${Path.DIRECTORY_SEPARATOR}chapter2")
!result.resources.test.toString().contains("warn${Path.DIRECTORY_SEPARATOR}chapter2") &&
if (getCurrentOs() == CurrentOs.WINDOWS) {
// These tests fail on Windows: https://github.com/saveourtool/save-cli/issues/402
!result.resources.test.toString().contains("warn-dir${Path.DIRECTORY_SEPARATOR}")
} else {
true
}
}?.let {
assertTrue(it.status is Pass)
assertTrue(
it.status is Pass,
"Test on resources ${it.resources} was expected to pass, but actually has status ${it.status}: $it"
)
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions save-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.saveourtool.save.generation.generateConfigOptions

import de.undercouch.gradle.tasks.download.Download
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import java.nio.file.Files
import java.nio.file.StandardCopyOption

plugins {
id("com.saveourtool.save.buildutils.kotlin-library")
Expand Down Expand Up @@ -78,8 +80,10 @@ tasks.register<Download>("downloadTestResources") {
))
dest("../examples/kotlin-diktat")
doLast {
file("../examples/kotlin-diktat/diktat-${Versions.IntegrationTest.diktat}.jar").renameTo(
file("../examples/kotlin-diktat/diktat.jar")
Files.move(
file("../examples/kotlin-diktat/diktat-${Versions.IntegrationTest.diktat}.jar").toPath(),
file("../examples/kotlin-diktat/diktat.jar").toPath(),
StandardCopyOption.REPLACE_EXISTING
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.saveourtool.save.core.integration

import com.saveourtool.save.core.test.utils.runTestsWithDiktat

import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertTrue

@Ignore // https://github.com/saveourtool/save-cli/issues/402
class WarnDirTest {
@Test
fun `execute warn plugin on the directory chapter1`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fun runTestsWithDiktat(
assertEquals(
Fail(
"(MISSING WARNINGS):" +
" [Warning(message=[DUMMY_ERROR] this error should not match, line=8, column=1," +
" [Warning(message=[DUMMY_ERROR] this error should not match{{.*}}, line=8, column=1," +
" fileName=ThisShouldAlwaysFailTest.kt)]",
"(MISSING WARNINGS): (1). (MATCHED WARNINGS): (1)"
), test.status
Expand Down