From ece7e95f02cdcdf9fa7c6fdfbf6db92e4cc0c87e Mon Sep 17 00:00:00 2001 From: mydeveloperday Date: Sat, 2 May 2020 15:42:20 +0100 Subject: [clang-format] NFC - clang-format the FormatTests Summary: Ensure the clang-format unit tests are themselves clang-formatted Having areas of the llvm code which are clang-format clean, give us more areas to run new clang-format binaries on ensuring we haven't broken anything. It seems to me we SHOULD have this clang-formatted at a minimum, otherwise how can we expect others to use clang-format if we "don't eat our own dogfood", also if the tests are dependent on the formatting of the code then that would also be bad! Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang, #clang-format Differential Revision: https://reviews.llvm.org/D79204 --- clang/unittests/Format/FormatTestJava.cpp | 56 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'clang/unittests/Format/FormatTestJava.cpp') diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index 5e73e4b..9a18c28 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/unittests/Format/FormatTestJava.cpp @@ -337,12 +337,12 @@ TEST_F(FormatTestJava, Annotations) { "List list;"); verifyFormat( - "@Test\n" - "@Feature({\"Android-TabSwitcher\"})\n" - "@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE})\n" - "@Features.EnableFeatures({FEATURE})\n" - "public void test(@Foo.bar(\"baz\") @Quux.Qoob int theFirstParaaaaam,\n" - " @Foo.bar(\"baz\") @Quux.Qoob int theSecondParaaaaaaaaaaaaaaaam) {}"); + "@Test\n" + "@Feature({\"Android-TabSwitcher\"})\n" + "@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE})\n" + "@Features.EnableFeatures({FEATURE})\n" + "public void test(@Foo.bar(\"baz\") @Quux.Qoob int theFirstParaaaaam,\n" + " @Foo.bar(\"baz\") @Quux.Qoob int theSecondParaaaaaaaaaaaaaaaam) {}"); } TEST_F(FormatTestJava, Generics) { @@ -460,19 +460,18 @@ TEST_F(FormatTestJava, MethodDeclarations) { } TEST_F(FormatTestJava, MethodReference) { - EXPECT_EQ( - "private void foo() {\n" - " f(this::methodReference);\n" - " f(C.super::methodReference);\n" - " Consumer c = System.out::println;\n" - " Iface mRef = Ty::meth;\n" - "}", - format("private void foo() {\n" - " f(this ::methodReference);\n" - " f(C.super ::methodReference);\n" - " Consumer c = System.out ::println;\n" - " Iface mRef = Ty :: meth;\n" - "}")); + EXPECT_EQ("private void foo() {\n" + " f(this::methodReference);\n" + " f(C.super::methodReference);\n" + " Consumer c = System.out::println;\n" + " Iface mRef = Ty::meth;\n" + "}", + format("private void foo() {\n" + " f(this ::methodReference);\n" + " f(C.super ::methodReference);\n" + " Consumer c = System.out ::println;\n" + " Iface mRef = Ty :: meth;\n" + "}")); } TEST_F(FormatTestJava, CppKeywords) { @@ -575,16 +574,15 @@ TEST_F(FormatTestJava, KeepsDelimitersOnOwnLineInJavaDocComments) { } TEST_F(FormatTestJava, RetainsLogicalShifts) { - verifyFormat("void f() {\n" - " int a = 1;\n" - " a >>>= 1;\n" - "}"); - verifyFormat("void f() {\n" - " int a = 1;\n" - " a = a >>> 1;\n" - "}"); + verifyFormat("void f() {\n" + " int a = 1;\n" + " a >>>= 1;\n" + "}"); + verifyFormat("void f() {\n" + " int a = 1;\n" + " a = a >>> 1;\n" + "}"); } - -} // end namespace tooling +} // namespace format } // end namespace clang -- cgit v1.1