[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 5 00:02:50 PDT 2024
================
@@ -28104,6 +28104,251 @@ TEST_F(FormatTest, BreakBinaryOperations) {
Style);
}
+TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) {
+ FormatStyle Style = getLLVMStyle();
+ Style.FixNamespaceComments = false;
+ Style.ShortNamespaceLines = 0;
+ Style.MaxEmptyLinesToKeep = 2;
+ Style.WrapNamespaceBodyWithEmptyLines = FormatStyle::WNBWELS_Never;
+ Style.CompactNamespaces = false;
+
+ // Empty namespace
+ verifyNoChange("namespace N {};", Style);
+
+ // Single namespace
+ verifyNoChange("namespace N {\n"
+ "int f1(int a) { return 2 * a; }\n"
+ "};",
+ Style);
+
+ // Nested namespace
+ verifyNoChange("namespace N1 {\n"
----------------
mydeveloperday wrote:
Ok, but the idea is that it messes with code as if the person was editing a file and this was the first clang-format, I've never needed to use `verifyNoChange` tests failing often meant I wasn't doing the correct thing
https://github.com/llvm/llvm-project/pull/106145
More information about the cfe-commits
mailing list