diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt index 590c6c7f6b5..a6257429c7a 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalCompilerRunnerTestBase.kt @@ -32,7 +32,7 @@ abstract class AbstractIncrementalCompilerRunnerTestBase.relativePaths() = - map { it.relativeTo(workingDir).path.replace('\\', '/') } + map { it.relativeTo(workingDir).path.replace('\\', '/') } val srcDir = File(workingDir, "src").apply { mkdirs() } val cacheDir = File(workingDir, "incremental-data").apply { mkdirs() } @@ -50,10 +50,12 @@ abstract class AbstractIncrementalCompilerRunnerTestBase()) - assertArrayEquals("diff1.newOrModified", - diff1.modified.toSortedPaths(), - listOf(removedTxt, unchangedTxt, changedTxt).toSortedPaths()) + assertArrayEquals( + "diff1.removed", + diff1.removed.toSortedPaths(), + emptyArray() + ) + assertArrayEquals( + "diff1.newOrModified", + diff1.modified.toSortedPaths(), + listOf(removedTxt, unchangedTxt, changedTxt).toSortedPaths() + ) removedTxt.delete() unchangedTxt.writeText("unchanged") @@ -50,17 +54,21 @@ class FileSnapshotMapTest : TestWithWorkingDir() { val newTxt = File(foo, "new.txt").apply { writeText("new") } val diff2 = snapshotMap.compareAndUpdate(src.filesWithExt("txt")) - assertArrayEquals("diff2.removed", - diff2.removed.toSortedPaths(), - listOf(removedTxt).toSortedPaths()) - assertArrayEquals("diff2.newOrModified", - diff2.modified.toSortedPaths(), - listOf(newTxt, changedTxt).toSortedPaths()) + assertArrayEquals( + "diff2.removed", + diff2.removed.toSortedPaths(), + listOf(removedTxt).toSortedPaths() + ) + assertArrayEquals( + "diff2.newOrModified", + diff2.modified.toSortedPaths(), + listOf(newTxt, changedTxt).toSortedPaths() + ) } private fun Iterable.toSortedPaths(): Array = - map { it.canonicalPath }.sorted().toTypedArray() + map { it.canonicalPath }.sorted().toTypedArray() private fun File.filesWithExt(ext: String): Iterable = - walk().filter { it.isFile && it.extension.equals(ext, ignoreCase = true) }.toList() + walk().filter { it.isFile && it.extension.equals(ext, ignoreCase = true) }.toList() } \ No newline at end of file diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/snapshots/FileSnapshotTest.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/snapshots/FileSnapshotTest.kt index 4c294372b82..30c15cef731 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/snapshots/FileSnapshotTest.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/snapshots/FileSnapshotTest.kt @@ -1,13 +1,13 @@ package org.jetbrains.kotlin.incremental.snapshots import org.jetbrains.kotlin.TestWithWorkingDir -import org.junit.Assert.* +import org.junit.Assert.assertNotEquals import org.junit.Test import java.io.* class FileSnapshotTest : TestWithWorkingDir() { private val fileSnapshotProvider: FileSnapshotProvider - get() = SimpleFileSnapshotProviderImpl() + get() = SimpleFileSnapshotProviderImpl() @Test fun testExternalizer() { diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/testLogsParsingUtil.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/testLogsParsingUtil.kt index d65d331653f..ce04ee61ef8 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/testLogsParsingUtil.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/testLogsParsingUtil.kt @@ -24,9 +24,9 @@ private const val END_COMPILED_FILES = "End of files" private const val BEGIN_ERRORS = "COMPILATION FAILED" class BuildStep( - val compiledKotlinFiles: MutableSet = hashSetOf(), - val compiledJavaFiles: MutableSet = hashSetOf(), - val compileErrors: MutableList = arrayListOf() + val compiledKotlinFiles: MutableSet = hashSetOf(), + val compiledJavaFiles: MutableSet = hashSetOf(), + val compileErrors: MutableList = arrayListOf() ) { val compileSucceeded: Boolean get() = compileErrors.isEmpty() @@ -69,11 +69,9 @@ fun parseTestBuildLog(file: File): List { if (path.endsWith(".kt")) { compiledKotlinFiles.add(path) - } - else if (path.endsWith(".java")) { + } else if (path.endsWith(".java")) { compiledJavaFiles.add(path) - } - else { + } else { throw IllegalStateException("Expected .kt or .java file, got: $path") } } @@ -109,7 +107,7 @@ fun dumpBuildLog(buildSteps: Iterable): String { sb.appendln() } - sb.appendln("================ Step #${i+1} =================") + sb.appendln("================ Step #${i + 1} =================") sb.appendln() sb.appendln(BEGIN_COMPILED_FILES) step.compiledKotlinFiles.sorted().forEach { sb.appendln(it) } diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestCompilationResult.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestCompilationResult.kt index 5cebbd97934..30dc354be9e 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestCompilationResult.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestCompilationResult.kt @@ -20,12 +20,12 @@ import org.jetbrains.kotlin.cli.common.ExitCode import java.io.File data class TestCompilationResult( - val exitCode: ExitCode, - val compiledSources: Iterable, - val compileErrors: Collection + val exitCode: ExitCode, + val compiledSources: Iterable, + val compileErrors: Collection ) { constructor( - icReporter: TestICReporter, - messageCollector: TestMessageCollector + icReporter: TestICReporter, + messageCollector: TestMessageCollector ) : this(icReporter.exitCode, icReporter.compiledSources, messageCollector.errors) } \ No newline at end of file diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestMessageCollector.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestMessageCollector.kt index eec9578644e..d249b8b1eab 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestMessageCollector.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/utils/TestMessageCollector.kt @@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental.utils import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector -import java.util.ArrayList +import java.util.* class TestMessageCollector : MessageCollector { val errors = ArrayList() @@ -35,5 +35,5 @@ class TestMessageCollector : MessageCollector { } override fun hasErrors(): Boolean = - errors.isNotEmpty() + errors.isNotEmpty() }