From ea69542c5c61e9ed60436cdf37c76ae4a5592f05 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Sun, 17 Dec 2023 06:57:59 -0800 Subject: [PATCH] FormatTests: improve asserting idempotency failure --- .../src/test/scala/org/scalafmt/FormatTests.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scalafmt-tests/src/test/scala/org/scalafmt/FormatTests.scala b/scalafmt-tests/src/test/scala/org/scalafmt/FormatTests.scala index bcde94dcbf..25c5da04e6 100644 --- a/scalafmt-tests/src/test/scala/org/scalafmt/FormatTests.scala +++ b/scalafmt-tests/src/test/scala/org/scalafmt/FormatTests.scala @@ -81,9 +81,14 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions { case Formatted.Success(code) => code } debug2.printTest() - assertEquals(formattedAgain, obtained, "Idempotency violated") - if (!onlyManual) { - assertEquals(obtained, t.expected) + if (onlyManual) + assertEquals(formattedAgain, obtained, "Idempotency violated") + else { + assertEquals( + if (formattedAgain == obtained) formattedAgain + else "Idempotency violated\n" + formattedAgain, + t.expected + ) } }