https://github.com/owenca created https://github.com/llvm/llvm-project/pull/136662
None >From 6f974f65a1f7b52d00e75afaad8201b748f7357a Mon Sep 17 00:00:00 2001 From: Owen Pan <owenpi...@gmail.com> Date: Tue, 22 Apr 2025 00:12:51 -0700 Subject: [PATCH] [clang-format] Don't test stability if JS format test fails --- clang/unittests/Format/FormatTestJS.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 1cfacc060d944..91577b9a49167 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -48,18 +48,22 @@ class FormatTestJS : public testing::Test { static void verifyFormat( StringRef Code, const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_JavaScript)) { - EXPECT_EQ(Code.str(), format(Code, Style)) << "Expected code is not stable"; - std::string Result = format(test::messUp(Code), Style); - EXPECT_EQ(Code.str(), Result) << "Formatted:\n" << Result; + auto Result = format(test::messUp(Code), Style); + EXPECT_EQ(Code, Result) << "Formatted:\n" << Result; + if (Code != Result) + return; + EXPECT_EQ(Code, format(Code, Style)) << "Expected code is not stable"; } static void verifyFormat( StringRef Expected, StringRef Code, const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_JavaScript)) { - EXPECT_EQ(Expected.str(), format(Expected, Style)) + auto Result = format(Code, Style); + EXPECT_EQ(Expected, Result) << "Formatted:\n" << Result; + if (Expected != Result) + return; + EXPECT_EQ(Expected, format(Expected, Style)) << "Expected code is not stable"; - std::string Result = format(Code, Style); - EXPECT_EQ(Expected.str(), Result) << "Formatted:\n" << Result; } }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits