This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbe656df18721: [clang-format] add a regression test for 
include sorting (authored by krasimir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124513/new/

https://reviews.llvm.org/D124513

Files:
  clang/unittests/Format/SortIncludesTest.cpp


Index: clang/unittests/Format/SortIncludesTest.cpp
===================================================================
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -458,6 +458,20 @@
                  "#include \"b.h\"\n"));
 }
 
+TEST_F(SortIncludesTest, HandlesTrailingCommentsWithAngleBrackets) {
+  // Regression test from the discussion at https://reviews.llvm.org/D121370.
+  EXPECT_EQ("#include <cstdint>\n"
+            "\n"
+            "#include \"util/bar.h\"\n"
+            "#include \"util/foo/foo.h\" // foo<T>\n",
+            sort("#include <cstdint>\n"
+                 "\n"
+                 "#include \"util/bar.h\"\n"
+                 "#include \"util/foo/foo.h\" // foo<T>\n",
+                 /*FileName=*/"input.cc",
+                 /*ExpectedNumRanges=*/0));
+}
+
 TEST_F(SortIncludesTest, LeavesMainHeaderFirst) {
   Style.IncludeIsMainRegex = "([-_](test|unittest))?$";
   EXPECT_EQ("#include \"llvm/a.h\"\n"


Index: clang/unittests/Format/SortIncludesTest.cpp
===================================================================
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -458,6 +458,20 @@
                  "#include \"b.h\"\n"));
 }
 
+TEST_F(SortIncludesTest, HandlesTrailingCommentsWithAngleBrackets) {
+  // Regression test from the discussion at https://reviews.llvm.org/D121370.
+  EXPECT_EQ("#include <cstdint>\n"
+            "\n"
+            "#include \"util/bar.h\"\n"
+            "#include \"util/foo/foo.h\" // foo<T>\n",
+            sort("#include <cstdint>\n"
+                 "\n"
+                 "#include \"util/bar.h\"\n"
+                 "#include \"util/foo/foo.h\" // foo<T>\n",
+                 /*FileName=*/"input.cc",
+                 /*ExpectedNumRanges=*/0));
+}
+
 TEST_F(SortIncludesTest, LeavesMainHeaderFirst) {
   Style.IncludeIsMainRegex = "([-_](test|unittest))?$";
   EXPECT_EQ("#include \"llvm/a.h\"\n"
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to