[Tests] Update test data after changes to FIR diagnostic messages
This commit is contained in:
committed by
Space Team
parent
de1c92a32f
commit
d0cc86f52c
+7
-2
@@ -72,7 +72,7 @@ class MainKtsTest {
|
||||
val resErr = evalFile(File("$TEST_DATA_ROOT/resolve-error-hamcrest-via-junit.main.kts"))
|
||||
Assert.assertTrue(
|
||||
resErr is ResultWithDiagnostics.Failure &&
|
||||
resErr.reports.any { it.message == "Unresolved reference: hamcrest" }
|
||||
resErr.reports.any { it.message.contains("Unresolved reference") && it.message.contains("hamcrest") }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -299,10 +299,15 @@ class MainKtsTest {
|
||||
"test failed - expecting a failure$expected but received " +
|
||||
(if (res is ResultWithDiagnostics.Failure) "failure" else "success") +
|
||||
":\n ${reports.joinToString("\n ")}",
|
||||
res is ResultWithDiagnostics.Failure && reports.any { report -> expectedErrors.any { report.contains(it) } }
|
||||
res is ResultWithDiagnostics.Failure && reports.any { report -> expectedErrors.any { report.containsIgnoringPunctuation(it) } }
|
||||
)
|
||||
}
|
||||
|
||||
private val regexNonWord = "\\W".toRegex()
|
||||
private fun String.containsIgnoringPunctuation(it: String): Boolean {
|
||||
return this.replace(regexNonWord, "").contains(it.replace(regexNonWord, ""))
|
||||
}
|
||||
|
||||
private fun evalSuccessWithOut(scriptFile: File, cacheDir: File? = null): List<String> =
|
||||
captureOut {
|
||||
val res = evalFile(scriptFile, cacheDir)
|
||||
|
||||
Reference in New Issue
Block a user