Author: Owen Pan Date: 2025-01-04T16:14:25-08:00 New Revision: 66f16e682f84551552099a45e608fa260b14e3ab
URL: https://github.com/llvm/llvm-project/commit/66f16e682f84551552099a45e608fa260b14e3ab DIFF: https://github.com/llvm/llvm-project/commit/66f16e682f84551552099a45e608fa260b14e3ab.diff LOG: [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.) Added: Modified: clang/unittests/Format/ConfigParseTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 9c38dbbc51f0a1..1f0beafaad7f74 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]", _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits