From d753da78292502cd7489b37561c1675b601741f9 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Wed, 13 Feb 2019 14:28:11 +0300 Subject: [PATCH] Improve output checker: default one checks with goldOutput --- .../groovy/org/jetbrains/kotlin/KonanTest.groovy | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index b29369f38e7..36e12a82c72 100644 --- a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -40,7 +40,8 @@ abstract class KonanTest extends JavaExec { def enableKonanAssertions = true String outputDirectory = null String goldValue = null - Function outputChecker = null + // Checks test's output against gold value and returns true if the output matches the expectation + Function outputChecker = { str -> (goldValue == null || goldValue == str) } String testData = null int expectedExitStatus = 0 List arguments = null @@ -309,10 +310,14 @@ abstract class KonanTest extends JavaExec { } result = result.replace(System.lineSeparator(), "\n") - def goldValueMismatch = (outputChecker != null && !outputChecker.apply(result)) || - (goldValue != null && goldValue != result) + def goldValueMismatch = !outputChecker.apply(result) if (goldValueMismatch) { - def message = "Expected output: $goldValue, actual output: $result" + def message + if (goldValue != null) { + message = "Expected output: $goldValue, actual output: $result" + } else { + message = "Actual output doesn't match output checker: $result" + } if (this.expectedFail) { println("Expected failure. $message") } else {