forked from qt-creator/qt-creator
ClangFormat: Enable includes sorting
Sort includes only in modes when all replacements are used (manual indentation with "Format instead of indent" selected and saving with "Format on save" activated). Change-Id: I73dfa1d3211760269fe7d33a141f4d831ff65c15 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -633,6 +633,23 @@ TEST_F(ClangFormat, FormatTemplateparameters)
|
||||
|
||||
ASSERT_THAT(documentLines(), ElementsAre("using Alias = Template<A, B, C>"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, SortIncludes)
|
||||
{
|
||||
insertLines({"#include \"b.h\"",
|
||||
"#include \"a.h\"",
|
||||
"",
|
||||
"#include <bb.h>",
|
||||
"#include <aa.h>"});
|
||||
|
||||
indenter.format({{1, 5}});
|
||||
|
||||
ASSERT_THAT(documentLines(), ElementsAre("#include \"a.h\"",
|
||||
"#include \"b.h\"",
|
||||
"",
|
||||
"#include <aa.h>",
|
||||
"#include <bb.h>"));
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user