@@ -48,18 +48,22 @@ class FormatTestJS : public testing::Test {
4848 static void verifyFormat (
4949 StringRef Code,
5050 const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_JavaScript)) {
51- EXPECT_EQ (Code.str (), format (Code, Style)) << " Expected code is not stable" ;
52- std::string Result = format (test::messUp (Code), Style);
53- EXPECT_EQ (Code.str (), Result) << " Formatted:\n " << Result;
51+ auto Result = format (test::messUp (Code), Style);
52+ EXPECT_EQ (Code, Result) << " Formatted:\n " << Result;
53+ if (Code != Result)
54+ return ;
55+ EXPECT_EQ (Code, format (Code, Style)) << " Expected code is not stable" ;
5456 }
5557
5658 static void verifyFormat (
5759 StringRef Expected, StringRef Code,
5860 const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_JavaScript)) {
59- EXPECT_EQ (Expected.str (), format (Expected, Style))
61+ auto Result = format (Code, Style);
62+ EXPECT_EQ (Expected, Result) << " Formatted:\n " << Result;
63+ if (Expected != Result)
64+ return ;
65+ EXPECT_EQ (Expected, format (Expected, Style))
6066 << " Expected code is not stable" ;
61- std::string Result = format (Code, Style);
62- EXPECT_EQ (Expected.str (), Result) << " Formatted:\n " << Result;
6367 }
6468};
6569
0 commit comments