From d3f17cd7e0473e89aeb2f8d35493dbc8f4dcd518 Mon Sep 17 00:00:00 2001 From: Kurt Alfred Kluever Date: Fri, 10 Jul 2026 08:36:12 -0700 Subject: [PATCH] Add a[] This test demonstrates that `google-java-format` currently adds two extra blank lines before a Javadoc comment that begins with a `` tag. PiperOrigin-RevId: 945727886 --- .../java/JavadocFormattingTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java index b4e3d6294..ac4cfc088 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -2150,6 +2150,29 @@ class Test {} doFormatTest(input, expected); } + @Test + public void tableAtStartOfComment() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = + """ + ///
+ /// + ///
Foo
+ class Test {} + """; + // TODO(kak): we shouldn't spew out these 2 leading blank lines + String expected = + """ + /// + /// + /// + /// + ///
Foo
+ class Test {} + """; + doFormatTest(input, expected); + } + // TODO: b/346668798 - Test the following Markdown constructs, and make the tests work as needed. // We can assume that the CommonMark parser correctly handles Markdown, so the question is whether // they are subsequently mishandled by our formatting logic. So for example the CommonMark parser