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:
Sergey Igushkin
2017-12-07 18:16:35 +03:00
parent 41086f26ae
commit 00d7150944
3 changed files with 8 additions and 3 deletions
@@ -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)
@@ -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() {
@@ -1,3 +1,4 @@
package foo
fun f(fn: (x: Int)->Unit) {}
@Suppress("unused_parameter")
fun f(fn: (x: Int)->Unit) { }