aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/ConfigParseTest.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2025-01-04 16:14:25 -0800
committerGitHub <noreply@github.com>2025-01-04 16:14:25 -0800
commit66f16e682f84551552099a45e608fa260b14e3ab (patch)
tree36a4f62452ecfa2fe8a5687665c62b51b68b9ad3 /clang/unittests/Format/ConfigParseTest.cpp
parent2bbdce9a42f58af4ca917eaba1bf1019ba658fd5 (diff)
downloadllvm-66f16e682f84551552099a45e608fa260b14e3ab.zip
llvm-66f16e682f84551552099a45e608fa260b14e3ab.tar.gz
llvm-66f16e682f84551552099a45e608fa260b14e3ab.tar.bz2
[clang-format][NFC] Add missing config tests for List of Strings (#121451)
Also, simplify the existing test for NamespaceMacros. Like the options tested by the added tests, it's also a list of arbitrary strings and initialized to an empty list. (The other existing tests for list of strings either are initialized to a list of one or more strings or require specific strings.)
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r--clang/unittests/Format/ConfigParseTest.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index 9c38dbb..1f0beaf 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -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()); \
@@ -906,11 +909,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]",