aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/ConfigParseTest.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 18:31:57 +0900
committerNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 18:33:27 +0900
commitdf025ebf872052c0761d44a3ef9b65e9675af8a8 (patch)
tree9b4e94583e2536546d6606270bcdf846c95e1ba2 /clang/unittests/Format/ConfigParseTest.cpp
parent4428c9d0b1344179f85a72e183a44796976521e3 (diff)
parentbdcf47e4bcb92889665825654bb80a8bbe30379e (diff)
downloadllvm-users/chapuni/cov/single/loop.zip
llvm-users/chapuni/cov/single/loop.tar.gz
llvm-users/chapuni/cov/single/loop.tar.bz2
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/loopusers/chapuni/cov/single/loop
Conflicts: clang/lib/CodeGen/CoverageMappingGen.cpp
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r--clang/unittests/Format/ConfigParseTest.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index 7fc7492..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()); \
@@ -159,6 +162,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
CHECK_PARSE_BOOL(AllowShortCompoundRequirementOnASingleLine);
CHECK_PARSE_BOOL(AllowShortEnumsOnASingleLine);
CHECK_PARSE_BOOL(AllowShortLoopsOnASingleLine);
+ CHECK_PARSE_BOOL(AllowShortNamespacesOnASingleLine);
CHECK_PARSE_BOOL(BinPackArguments);
CHECK_PARSE_BOOL(BreakAdjacentStringLiterals);
CHECK_PARSE_BOOL(BreakAfterJavaFieldAnnotations);
@@ -864,6 +868,13 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE("SortUsingDeclarations: true", SortUsingDeclarations,
FormatStyle::SUD_LexicographicNumeric);
+ CHECK_PARSE("WrapNamespaceBodyWithEmptyLines: Never",
+ WrapNamespaceBodyWithEmptyLines, FormatStyle::WNBWELS_Never);
+ CHECK_PARSE("WrapNamespaceBodyWithEmptyLines: Always",
+ WrapNamespaceBodyWithEmptyLines, FormatStyle::WNBWELS_Always);
+ CHECK_PARSE("WrapNamespaceBodyWithEmptyLines: Leave",
+ WrapNamespaceBodyWithEmptyLines, FormatStyle::WNBWELS_Leave);
+
// FIXME: This is required because parsing a configuration simply overwrites
// the first N elements of the list instead of resetting it.
Style.ForEachMacros.clear();
@@ -898,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]",