diff options
author | Daniel Jasper <djasper@google.com> | 2016-03-21 14:11:27 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-03-21 14:11:27 +0000 |
commit | 9c8ff3551ace965a3232fc4a1b53a75015a706cf (patch) | |
tree | b79665461141afc99d5bf130a71991d5ac645aaa /clang/unittests/Format/FormatTest.cpp | |
parent | 4aeab5fbf241a06fbd8fef719b94466da7f2f6d4 (diff) | |
download | bcm5719-llvm-9c8ff3551ace965a3232fc4a1b53a75015a706cf.tar.gz bcm5719-llvm-9c8ff3551ace965a3232fc4a1b53a75015a706cf.zip |
clang-format: Make include sorting's main include detection configurable.
This patch adds a regular expression to configure suffixes of an
included file to check whether it is the "main" include of the current
file. Previously, clang-format has allowed arbitrary suffixes on the
formatted file, which is still the case when no IncludeMainRegex is
specified.
llvm-svn: 263943
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index ff932c88c7c..d2ec4e645c9 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -9941,6 +9941,7 @@ TEST_F(FormatTest, ParsesConfiguration) { SpacesBeforeTrailingComments, 1234u); CHECK_PARSE("IndentWidth: 32", IndentWidth, 32u); CHECK_PARSE("ContinuationIndentWidth: 11", ContinuationIndentWidth, 11u); + CHECK_PARSE("CommentPragmas: '// abc$'", CommentPragmas, "// abc$"); Style.PointerAlignment = FormatStyle::PAS_Middle; CHECK_PARSE("PointerAlignment: Left", PointerAlignment, @@ -10099,6 +10100,7 @@ TEST_F(FormatTest, ParsesConfiguration) { " - Regex: .*\n" " Priority: 1", IncludeCategories, ExpectedCategories); + CHECK_PARSE("IncludeIsMainRegex: 'abc$'", IncludeIsMainRegex, "abc$"); } TEST_F(FormatTest, ParsesConfigurationWithLanguages) { |