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 f0014a211..92f65be6b 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -2622,6 +2622,100 @@ class Test {} doFormatTest(input, expected); } + @Test + public void unclosedInlineTagInList() { + String input = + """ + /** + *
Next paragraph that is also long enough to exceed the line length limit and require line wrapping. + */ + class Test {} + """; + // TODO(b/407787200): Lexing fails due to unclosed inline tag, leaving comment unformatted. + String expected = + """ + /** + * Some description with {@link #validating() sets (allowInvalid=false, mayDissolve=false, snapFunction=null): Do not modify the input geometry. + * + *
Next paragraph that is also long enough to exceed the line length limit and require line wrapping. + */ + class Test {} + """; + doFormatTest(input, expected); + } + + @Test + public void unclosedInlineTagBeforeFooterTag() { + String input = + """ + /** + * Some description with {@link #validating() sets (allowInvalid=false, mayDissolve=false, snapFunction=null): Do not modify the input geometry. + * + * @param x a parameter description that is also long enough to exceed the line length limit and require line wrapping + */ + class Test {} + """; + // TODO(b/407787200): Lexing fails due to unclosed inline tag, leaving comment unformatted. + String expected = + """ + /** + * Some description with {@link #validating() sets (allowInvalid=false, mayDissolve=false, snapFunction=null): Do not modify the input geometry. + * + * @param x a parameter description that is also long enough to exceed the line length limit and require line wrapping + */ + 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