================ @@ -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" ---------------- dmasloff wrote:
Used `verifyNoChange` because `verifyFormat` has a strange behaviour with newlines and for no reasons tests were failing with it even though compiled `clang-format` with the same config formatted code exactly as I expected it. Also my option is quite interconnected with `MaxEmptyLinesToKeep`, whose behaviour is mostly tested with `verifyNoChange` and it works as expected https://github.com/llvm/llvm-project/pull/106145 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits