diff options
author | Owen Pan <owenpiano@gmail.com> | 2025-05-19 01:32:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-19 01:32:17 -0700 |
commit | 5ddcd765dbb088b3fe8eb09dd38db1252981962c (patch) | |
tree | e6116fd5f96c6841f5a8276728edca24a0b96e79 /clang/unittests/Format/ConfigParseTest.cpp | |
parent | 6da2acf8e99ec517bfbe498af2519d29834e2583 (diff) | |
download | llvm-5ddcd765dbb088b3fe8eb09dd38db1252981962c.zip llvm-5ddcd765dbb088b3fe8eb09dd38db1252981962c.tar.gz llvm-5ddcd765dbb088b3fe8eb09dd38db1252981962c.tar.bz2 |
[clang-format][NFC] Upgrade SortIncludes option to a struct (#140497)
This allows adding other suboptions e.g. IgnoreExtension in #137840.
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r-- | clang/unittests/Format/ConfigParseTest.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index bd27a9f..5b9055d 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -257,6 +257,8 @@ TEST(ConfigParseTest, ParsesConfigurationBools) { CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InConditionalStatements); CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InEmptyParentheses); CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, Other); + CHECK_PARSE_NESTED_BOOL(SortIncludes, Enabled); + CHECK_PARSE_NESTED_BOOL(SortIncludes, IgnoreCase); } #undef CHECK_PARSE_BOOL @@ -976,15 +978,20 @@ TEST(ConfigParseTest, ParsesConfiguration) { CHECK_PARSE("IncludeIsMainSourceRegex: 'abc$'", IncludeStyle.IncludeIsMainSourceRegex, "abc$"); - Style.SortIncludes = FormatStyle::SI_Never; + Style.SortIncludes = {}; CHECK_PARSE("SortIncludes: true", SortIncludes, - FormatStyle::SI_CaseSensitive); - CHECK_PARSE("SortIncludes: false", SortIncludes, FormatStyle::SI_Never); + FormatStyle::SortIncludesOptions( + {/*Enabled=*/true, /*IgnoreCase=*/false})); + CHECK_PARSE("SortIncludes: false", SortIncludes, + FormatStyle::SortIncludesOptions({})); CHECK_PARSE("SortIncludes: CaseInsensitive", SortIncludes, - FormatStyle::SI_CaseInsensitive); + FormatStyle::SortIncludesOptions( + {/*Enabled=*/true, /*IgnoreCase=*/true})); CHECK_PARSE("SortIncludes: CaseSensitive", SortIncludes, - FormatStyle::SI_CaseSensitive); - CHECK_PARSE("SortIncludes: Never", SortIncludes, FormatStyle::SI_Never); + FormatStyle::SortIncludesOptions( + {/*Enabled=*/true, /*IgnoreCase=*/false})); + CHECK_PARSE("SortIncludes: Never", SortIncludes, + FormatStyle::SortIncludesOptions({})); Style.RawStringFormats.clear(); std::vector<FormatStyle::RawStringFormat> ExpectedRawStringFormats = { |