Assert that formatter snippet test output is stable (#1270)

This commit is contained in:
Jen Basch authored and GitHub committed 2025-10-29 17:08:43 -07:00
1 parent 1d6261b263
commit 7bf150055c
4 files changed
+65 -8

No files matched your search

@@ -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)
}