Fix warning check in tests:
* Fix the regex that could not actually find warnings * Suppress an unused parameter warning in the test project * Add allWarningsAsErrors to ExecutionStrategyIT
This commit is contained in:
+1
-1
@@ -299,7 +299,7 @@ abstract class BaseGradleIT {
|
||||
}
|
||||
|
||||
fun CompiledProject.assertNoWarnings() {
|
||||
val warnings = "w: .*$".toRegex().findAll(output).map { it.groupValues[0] }
|
||||
val warnings = "w: .*".toRegex().findAll(output).map { it.groupValues[0] }
|
||||
|
||||
if (warnings.any()) {
|
||||
val message = (listOf("Output should not contain any warnings:") + warnings).joinToString(SYSTEM_LINE_SEPARATOR)
|
||||
|
||||
+5
-1
@@ -7,7 +7,7 @@ import java.io.File
|
||||
|
||||
class ExecutionStrategyJsIT : ExecutionStrategyIT() {
|
||||
override fun setupProject(project: Project) {
|
||||
project.setupWorkingDir()
|
||||
super.setupProject(project)
|
||||
val buildGradle = File(project.projectDir, "app/build.gradle")
|
||||
buildGradle.modify { it.replace("apply plugin: \"kotlin\"", "apply plugin: \"kotlin2js\"") +
|
||||
"\ncompileKotlin2Js.kotlinOptions.outputFile = \"web/js/out.js\"" }
|
||||
@@ -62,6 +62,10 @@ open class ExecutionStrategyIT : BaseGradleIT() {
|
||||
}
|
||||
|
||||
protected open fun setupProject(project: Project) {
|
||||
project.setupWorkingDir()
|
||||
File(project.projectDir, "app/build.gradle").appendText(
|
||||
"\ntasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { kotlinOptions.allWarningsAsErrors = true }"
|
||||
)
|
||||
}
|
||||
|
||||
protected open fun CompiledProject.checkOutput() {
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
package foo
|
||||
|
||||
fun f(fn: (x: Int)->Unit) {}
|
||||
@Suppress("unused_parameter")
|
||||
fun f(fn: (x: Int)->Unit) { }
|
||||
Reference in New Issue
Block a user