diff options
| author | Daniel Jasper <djasper@google.com> | 2015-11-16 12:38:56 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2015-11-16 12:38:56 +0000 |
| commit | da446770823be1b1d1562734e55da7c1a5f2579c (patch) | |
| tree | 2bf41eaac2d5dcd6b8181359a850bbd26e037fe4 /clang/unittests/Format | |
| parent | bc09f39476723d319feaac18c948cd3498681136 (diff) | |
| download | bcm5719-llvm-da446770823be1b1d1562734e55da7c1a5f2579c.tar.gz bcm5719-llvm-da446770823be1b1d1562734e55da7c1a5f2579c.zip | |
clang-format: Enable #include sorting by default.
This has seen quite some usage and I am not aware of any issues. Also
add a style option to enable/disable include sorting. The existing
command line flag can from now on be used to override whatever is set
in the style.
llvm-svn: 253202
Diffstat (limited to 'clang/unittests/Format')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/SortIncludesTest.cpp | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1c68d67956c..1c5e63b3e08 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -9563,12 +9563,14 @@ TEST_F(FormatTest, ParsesConfigurationBools) { CHECK_PARSE_BOOL(ConstructorInitializerAllOnOneLineOrOnePerLine); CHECK_PARSE_BOOL(DerivePointerAlignment); CHECK_PARSE_BOOL_FIELD(DerivePointerAlignment, "DerivePointerBinding"); + CHECK_PARSE_BOOL(DisableFormat); CHECK_PARSE_BOOL(IndentCaseLabels); CHECK_PARSE_BOOL(IndentWrappedFunctionNames); CHECK_PARSE_BOOL(KeepEmptyLinesAtTheStartOfBlocks); CHECK_PARSE_BOOL(ObjCSpaceAfterProperty); CHECK_PARSE_BOOL(ObjCSpaceBeforeProtocolList); CHECK_PARSE_BOOL(Cpp11BracedListStyle); + CHECK_PARSE_BOOL(SortIncludes); CHECK_PARSE_BOOL(SpacesInParentheses); CHECK_PARSE_BOOL(SpacesInSquareBrackets); CHECK_PARSE_BOOL(SpacesInAngles); diff --git a/clang/unittests/Format/SortIncludesTest.cpp b/clang/unittests/Format/SortIncludesTest.cpp index 84bc554edd1..30109ffb728 100644 --- a/clang/unittests/Format/SortIncludesTest.cpp +++ b/clang/unittests/Format/SortIncludesTest.cpp @@ -40,6 +40,16 @@ TEST_F(SortIncludesTest, BasicSorting) { "#include \"b.h\"\n")); } +TEST_F(SortIncludesTest, IncludeSortingCanBeDisabled) { + Style.SortIncludes = false; + EXPECT_EQ("#include \"a.h\"\n" + "#include \"c.h\"\n" + "#include \"b.h\"\n", + sort("#include \"a.h\"\n" + "#include \"c.h\"\n" + "#include \"b.h\"\n")); +} + TEST_F(SortIncludesTest, MixIncludeAndImport) { EXPECT_EQ("#include \"a.h\"\n" "#import \"b.h\"\n" |

