mirror of
https://github.com/apple/pkl.git
synced 2026-04-24 01:08:34 +02:00
Assert that formatter snippet test output is stable (#1270)
This commit is contained in:
@@ -111,12 +111,14 @@ data class SnippetOutcome(val expectedOutFile: Path, val actual: String, val suc
|
||||
}
|
||||
}
|
||||
|
||||
private fun failWithDiff(message: String): Nothing =
|
||||
if (System.getProperty("sun.java.command", "").contains("intellij")) {
|
||||
// IntelliJ only shows diffs for AssertionFailedError
|
||||
throw AssertionFailedError(message, expected, actual)
|
||||
} else {
|
||||
// Gradle test logging/report only shows diffs for PklAssertionFailedError
|
||||
throw PklAssertionFailedError(message, expected, actual)
|
||||
}
|
||||
private fun failWithDiff(message: String): Nothing = failWithDiff(message, expected, actual)
|
||||
}
|
||||
|
||||
fun failWithDiff(message: String, expected: String, actual: String): Nothing =
|
||||
if (System.getProperty("sun.java.command", "").contains("intellij")) {
|
||||
// IntelliJ only shows diffs for AssertionFailedError
|
||||
throw AssertionFailedError(message, expected, actual)
|
||||
} else {
|
||||
// Gradle test logging/report only shows diffs for PklAssertionFailedError
|
||||
throw PklAssertionFailedError(message, expected, actual)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user