diff options
author | Daniel Jasper <djasper@google.com> | 2015-12-21 17:28:24 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-12-21 17:28:24 +0000 |
commit | a252f5d56d6932ac67733b72177c8550f086138a (patch) | |
tree | 3750f28b30c2acf68658aa433d113b3bdbb2255c /clang/unittests/Format/SortIncludesTest.cpp | |
parent | d544e0c100609594aa18563a1ae4f1cb4c7ad12a (diff) | |
download | bcm5719-llvm-a252f5d56d6932ac67733b72177c8550f086138a.tar.gz bcm5719-llvm-a252f5d56d6932ac67733b72177c8550f086138a.zip |
clang-format: Only consider the first #include that looks right to be
the main #include.
llvm-svn: 256170
Diffstat (limited to 'clang/unittests/Format/SortIncludesTest.cpp')
-rw-r--r-- | clang/unittests/Format/SortIncludesTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/Format/SortIncludesTest.cpp b/clang/unittests/Format/SortIncludesTest.cpp index d96227d13ee..dbe11749572 100644 --- a/clang/unittests/Format/SortIncludesTest.cpp +++ b/clang/unittests/Format/SortIncludesTest.cpp @@ -204,6 +204,17 @@ TEST_F(SortIncludesTest, LeavesMainHeaderFirst) { "#include \"c.h\"\n" "#include \"b.h\"\n", "a.cc")); + + // Only recognize the first #include with a matching basename as main include. + EXPECT_EQ("#include \"a.h\"\n" + "#include \"b.h\"\n" + "#include \"c.h\"\n" + "#include \"llvm/a.h\"\n", + sort("#include \"b.h\"\n" + "#include \"a.h\"\n" + "#include \"c.h\"\n" + "#include \"llvm/a.h\"\n", + "a.cc")); } TEST_F(SortIncludesTest, NegativePriorities) { |