[clang-tools-extra] r330580 - Fix tests after changes to clang-format in r330573.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 23 04:47:59 PDT 2018
Author: klimek
Date: Mon Apr 23 04:47:59 2018
New Revision: 330580
URL: http://llvm.org/viewvc/llvm-project?rev=330580&view=rev
Log:
Fix tests after changes to clang-format in r330573.
We do now both:
- stop reformatting a sequence after a closing brace in more cases, in
order to not misindent after an incorrect closing brace
- format the closing brace when formatting the line containing the
opening brace
Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
Modified: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp?rev=330580&r1=330579&r2=330580&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp Mon Apr 23 04:47:59 2018
@@ -19,15 +19,15 @@ void test() {
// CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
// CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
// CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
- // CHECK-FIXES: {{^}} if (1) {{{$}}
- // CHECK-FIXES-NEXT: {{^}} while (2) {
- // CHECK-FIXES-NEXT: {{^}} if (3) {
- // CHECK-FIXES-NEXT: {{^}} for (;;) {
- // CHECK-FIXES-NEXT: {{^}} do {
- // CHECK-FIXES-NEXT: {{^}} ;
- // CHECK-FIXES-NEXT: {{^}} } while (false) /**/; /**/
- // CHECK-FIXES-NEXT: {{^}} }
- // CHECK-FIXES-NEXT: {{^}} }
- // CHECK-FIXES-NEXT: {{^}} }
- // CHECK-FIXES-NEXT: {{^}} }
+ // CHECK-FIXES: {{^}} if (1) {{{$}}
+ // CHECK-FIXES-NEXT: {{^}} while (2) {
+ // CHECK-FIXES-NEXT: {{^}} if (3) {
+ // CHECK-FIXES-NEXT: {{^}} for (;;) {
+ // CHECK-FIXES-NEXT: {{^}} do {
+ // CHECK-FIXES-NEXT: {{^}} ;
+ // CHECK-FIXES-NEXT: {{^}} } while (false) /**/; /**/
+ // CHECK-FIXES-NEXT: {{^}} }
+ // CHECK-FIXES-NEXT: {{^}} }
+ // CHECK-FIXES-NEXT: {{^}} }
+ // CHECK-FIXES-NEXT: {{^}} }
}
Modified: clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp?rev=330580&r1=330579&r2=330580&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp Mon Apr 23 04:47:59 2018
@@ -196,7 +196,8 @@ TEST(IncludeFixer, ScopedNamespaceSymbol
runIncludeFixer("namespace a {\nb::bar b;\n}"));
EXPECT_EQ("#include \"bar.h\"\nnamespace A {\na::b::bar b;\n}",
runIncludeFixer("namespace A {\na::b::bar b;\n}"));
- EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nvoid func() { b::bar b; }\n}",
+ EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nvoid func() { b::bar b; }\n} "
+ "// namespace a",
runIncludeFixer("namespace a {\nvoid func() { b::bar b; }\n}"));
EXPECT_EQ("namespace A { c::b::bar b; }\n",
runIncludeFixer("namespace A { c::b::bar b; }\n"));
@@ -258,7 +259,8 @@ TEST(IncludeFixer, FixNamespaceQualifier
runIncludeFixer("namespace a {\nb::bar b;\n}\n"));
EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nb::bar b;\n}\n",
runIncludeFixer("namespace a {\nbar b;\n}\n"));
- EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nnamespace b{\nbar b;\n}\n}\n",
+ EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nnamespace b{\nbar b;\n}\n} "
+ "// namespace a\n",
runIncludeFixer("namespace a {\nnamespace b{\nbar b;\n}\n}\n"));
EXPECT_EQ("c::b::bar b;\n",
runIncludeFixer("c::b::bar b;\n"));
@@ -268,12 +270,12 @@ TEST(IncludeFixer, FixNamespaceQualifier
runIncludeFixer("namespace c {\nbar b;\n}\n"));
// Test common qualifers reduction.
- EXPECT_EQ(
- "#include \"bar.h\"\nnamespace a {\nnamespace d {\nb::bar b;\n}\n}\n",
- runIncludeFixer("namespace a {\nnamespace d {\nbar b;\n}\n}\n"));
- EXPECT_EQ(
- "#include \"bar.h\"\nnamespace d {\nnamespace a {\na::b::bar b;\n}\n}\n",
- runIncludeFixer("namespace d {\nnamespace a {\nbar b;\n}\n}\n"));
+ EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nnamespace d {\nb::bar b;\n}\n} "
+ "// namespace a\n",
+ runIncludeFixer("namespace a {\nnamespace d {\nbar b;\n}\n}\n"));
+ EXPECT_EQ("#include \"bar.h\"\nnamespace d {\nnamespace a {\na::b::bar "
+ "b;\n}\n} // namespace d\n",
+ runIncludeFixer("namespace d {\nnamespace a {\nbar b;\n}\n}\n"));
// Test nested classes.
EXPECT_EQ("#include \"bar.h\"\nnamespace d {\na::b::bar::t b;\n}\n",
More information about the cfe-commits
mailing list