Skip to content

[clang-format][NFC] Add missing config tests for List of Strings #121451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions clang/unittests/Format/ConfigParseTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ TEST(ConfigParseTest, GetsCorrectBasedOnStyle) {
EXPECT_EQ(0, parseConfiguration(TEXT, &Style).value()); \
EXPECT_EQ(VALUE, Style.FIELD) << "Unexpected value after parsing!"

#define CHECK_PARSE_LIST(FIELD) \
CHECK_PARSE(#FIELD ": [foo]", FIELD, std::vector<std::string>{"foo"})

#define CHECK_PARSE_NESTED_VALUE(TEXT, STRUCT, FIELD, VALUE) \
EXPECT_NE(VALUE, Style.STRUCT.FIELD) << "Initial value already the same!"; \
EXPECT_EQ(0, parseConfiguration(#STRUCT ":\n " TEXT, &Style).value()); \
Expand Down Expand Up @@ -899,11 +902,15 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE("StatementMacros: [QUNUSED, QT_REQUIRE_VERSION]", StatementMacros,
std::vector<std::string>({"QUNUSED", "QT_REQUIRE_VERSION"}));

Style.NamespaceMacros.clear();
CHECK_PARSE("NamespaceMacros: [TESTSUITE]", NamespaceMacros,
std::vector<std::string>{"TESTSUITE"});
CHECK_PARSE("NamespaceMacros: [TESTSUITE, SUITE]", NamespaceMacros,
std::vector<std::string>({"TESTSUITE", "SUITE"}));
CHECK_PARSE_LIST(JavaImportGroups);
CHECK_PARSE_LIST(Macros);
CHECK_PARSE_LIST(NamespaceMacros);
CHECK_PARSE_LIST(ObjCPropertyAttributeOrder);
CHECK_PARSE_LIST(TableGenBreakingDAGArgOperators);
CHECK_PARSE_LIST(TemplateNames);
CHECK_PARSE_LIST(TypeNames);
CHECK_PARSE_LIST(TypenameMacros);
CHECK_PARSE_LIST(VariableTemplates);

Style.WhitespaceSensitiveMacros.clear();
CHECK_PARSE("WhitespaceSensitiveMacros: [STRINGIZE]",
Expand Down
Loading