forked from OSchip/llvm-project
[clang-format] add a regression test for include sorting
This adds a regression test from the comments on https://reviews.llvm.org/D121370. Reviewed By: MyDeveloperDay, curdeius Differential Revision: https://reviews.llvm.org/D124513
This commit is contained in:
parent
e8cc7490d2
commit
be656df187
|
@ -458,6 +458,20 @@ TEST_F(SortIncludesTest, HandlesMultilineIncludes) {
|
|||
"#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"
|
||||
|
|
Loading…
Reference in New Issue