Fix tests broken in c6fa3634
This commit is contained in:
committed by
TeamCityServer
parent
a1c1a32515
commit
9cb740bfdb
@@ -1,3 +1,6 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
compiler/testData/cli/jvm/conflictingProjection.kt:10:15: error: projection is conflicting with variance of the corresponding type parameter of Out<in kotlin/Int>. Remove the projection or replace it with '*'
|
||||
fun a8(value: Out<in Int>) {}
|
||||
^
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
compiler/testData/cli/jvm/extendedCheckers.kt:2:12: warning: redundant explicit type
|
||||
val i: Int = 1
|
||||
^
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
OK
|
||||
|
||||
+3
@@ -1,3 +1,6 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
compiler/testData/cli/jvm/firError.kt:5:13: error: x must be initialized before access
|
||||
println(x)
|
||||
^
|
||||
|
||||
+3
@@ -1 +1,4 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
OK
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
compiler/testData/cli/jvm/inapplicableLateinitModifier.kt:6:1: error: 'lateinit' modifier is not allowed on delegated properties
|
||||
lateinit var kest by Delegate
|
||||
^
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: unresolved reference: getSomeInt
|
||||
constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
|
||||
^
|
||||
|
||||
+29
-21
@@ -51,15 +51,15 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
|
||||
* @return [destination]
|
||||
*/
|
||||
protected fun compileLibrary(
|
||||
libraryName: String,
|
||||
destination: File = File(tmpdir, "$libraryName.jar"),
|
||||
additionalOptions: List<String> = emptyList(),
|
||||
compileJava: (sourceDir: File, javaFiles: List<File>, outputDir: File) -> Boolean = { _, javaFiles, outputDir ->
|
||||
KotlinTestUtils.compileJavaFiles(javaFiles, listOf("-d", outputDir.path))
|
||||
},
|
||||
checkKotlinOutput: (String) -> Unit = { actual -> assertEquals(normalizeOutput("" to ExitCode.OK), actual) },
|
||||
manifest: Manifest? = null,
|
||||
extraClassPath: List<File> = emptyList()
|
||||
libraryName: String,
|
||||
destination: File = File(tmpdir, "$libraryName.jar"),
|
||||
additionalOptions: List<String> = emptyList(),
|
||||
compileJava: (sourceDir: File, javaFiles: List<File>, outputDir: File) -> Boolean = { _, javaFiles, outputDir ->
|
||||
KotlinTestUtils.compileJavaFiles(javaFiles, listOf("-d", outputDir.path))
|
||||
},
|
||||
checkKotlinOutput: (String) -> Unit = { actual -> assertEquals(normalizeOutput("" to ExitCode.OK), actual) },
|
||||
manifest: Manifest? = null,
|
||||
extraClassPath: List<File> = emptyList()
|
||||
): File {
|
||||
val sourceDir = File(testDataDirectory, libraryName)
|
||||
val javaFiles = FileUtil.findFilesByMask(JAVA_FILES, sourceDir)
|
||||
@@ -84,13 +84,12 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
|
||||
if (isJar) {
|
||||
destination.delete()
|
||||
val stream =
|
||||
if (manifest != null) JarOutputStream(destination.outputStream(), manifest)
|
||||
else JarOutputStream(destination.outputStream())
|
||||
if (manifest != null) JarOutputStream(destination.outputStream(), manifest)
|
||||
else JarOutputStream(destination.outputStream())
|
||||
stream.use { jar ->
|
||||
ZipUtil.addDirToZipRecursively(jar, destination, outputDir, "", null, null)
|
||||
}
|
||||
}
|
||||
else assertNull("Manifest is ignored if destination is not a .jar file", manifest)
|
||||
} else assertNull("Manifest is ignored if destination is not a .jar file", manifest)
|
||||
|
||||
return destination
|
||||
}
|
||||
@@ -132,17 +131,26 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
protected fun normalizeOutput(output: Pair<String, ExitCode>): String {
|
||||
return AbstractCliTest.getNormalizedCompilerOutput(output.first, output.second, testDataDirectory.path)
|
||||
.replace(FileUtil.toSystemIndependentName(tmpdir.absolutePath), "\$TMP_DIR\$")
|
||||
return AbstractCliTest.getNormalizedCompilerOutput(output.first, output.second, testDataDirectory.path).removeFirWarning()
|
||||
.replace(FileUtil.toSystemIndependentName(tmpdir.absolutePath), "\$TMP_DIR\$")
|
||||
}
|
||||
|
||||
private fun String.removeFirWarning(): String {
|
||||
return this.replace(
|
||||
"""warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
""", ""
|
||||
)
|
||||
}
|
||||
|
||||
protected fun compileKotlin(
|
||||
fileName: String,
|
||||
output: File,
|
||||
classpath: List<File> = emptyList(),
|
||||
compiler: CLICompiler<*> = K2JVMCompiler(),
|
||||
additionalOptions: List<String> = emptyList(),
|
||||
expectedFileName: String? = "output.txt"
|
||||
fileName: String,
|
||||
output: File,
|
||||
classpath: List<File> = emptyList(),
|
||||
compiler: CLICompiler<*> = K2JVMCompiler(),
|
||||
additionalOptions: List<String> = emptyList(),
|
||||
expectedFileName: String? = "output.txt"
|
||||
): Pair<String, ExitCode> {
|
||||
val args = mutableListOf<String>()
|
||||
val sourceFile = File(testDataDirectory, fileName)
|
||||
|
||||
+3
-2
@@ -514,8 +514,9 @@ abstract class BaseGradleIT {
|
||||
assertNull(regex.find(output), "Output should not contain '$regex'")
|
||||
}
|
||||
|
||||
fun CompiledProject.assertNoWarnings() {
|
||||
val warnings = "w: .*".toRegex().findAll(output).map { it.groupValues[0] }
|
||||
fun CompiledProject.assertNoWarnings(sanitize: (String) -> String = { it }) {
|
||||
val clearedOutput = sanitize(output)
|
||||
val warnings = "w: .*".toRegex().findAll(clearedOutput).map { it.groupValues[0] }
|
||||
|
||||
if (warnings.any()) {
|
||||
val message = (listOf("Output should not contain any warnings:") + warnings).joinToString(SYSTEM_LINE_SEPARATOR)
|
||||
|
||||
+10
-2
@@ -182,7 +182,7 @@ class KotlinGradleIT : BaseGradleIT() {
|
||||
|
||||
project.build("build", options = options) {
|
||||
assertSuccessful()
|
||||
assertNoWarnings()
|
||||
assertNoWarnings { removeFirWarning(it) }
|
||||
}
|
||||
|
||||
val greeterKt = project.projectDir.getFileByName("Greeter.kt")
|
||||
@@ -192,7 +192,7 @@ class KotlinGradleIT : BaseGradleIT() {
|
||||
|
||||
project.build("build", options = options) {
|
||||
assertSuccessful()
|
||||
assertNoWarnings()
|
||||
assertNoWarnings { removeFirWarning(it) }
|
||||
val affectedSources = project.projectDir.getFilesByNames(
|
||||
"Greeter.kt", "KotlinGreetingJoiner.kt",
|
||||
"TestGreeter.kt", "TestKotlinGreetingJoiner.kt"
|
||||
@@ -201,6 +201,14 @@ class KotlinGradleIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeFirWarning(output: String): String {
|
||||
return output.replace(
|
||||
"""w: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir""", ""
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testManyClassesIC() {
|
||||
val project = Project("manyClasses")
|
||||
|
||||
Reference in New Issue
Block a user