Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,100 @@ class Test {}
doFormatTest(input, expected);
}

@Test
public void unclosedInlineTagInList() {
String input =
"""
/**
* <ul>
* <li>{@link #validating() sets (allowInvalid=false, mayDissolve=false, snapFunction=null): Do not modify the input geometry. Validate it instead.
* <li>3. Check if the input geometry is valid as is.
* </ul>
*/
class Test {}
""";
// TODO(b/407787200): Lexing fails due to unclosed inline tag, leaving comment unformatted.
String expected =
"""
/**
* <ul>
* <li>{@link #validating() sets (allowInvalid=false, mayDissolve=false, snapFunction=null): Do not modify the input geometry. Validate it instead.
* <li>3. Check if the input geometry is valid as is.
* </ul>
*/
class Test {}
""";
doFormatTest(input, expected);
}

@Test
public void unclosedInlineTagAtEndOfComment() {
String input =
"""
/**
* Return the child position of this cell within its parent. For more details, see {@link com.google.common.geometry.S2CellId
*/
class Test {}
""";
// TODO(b/407787200): Lexing fails due to unclosed inline tag, leaving comment unformatted.
String expected =
"""
/**
* Return the child position of this cell within its parent. For more details, see {@link com.google.common.geometry.S2CellId
*/
class Test {}
""";
doFormatTest(input, expected);
}

@Test
public void unclosedInlineTagBeforeBlankLine() {
String input =
"""
/**
* Some description with {@link #validating() sets (allowInvalid=false, mayDissolve=false, snapFunction=null): Do not modify the input geometry.
*
* <p>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.
*
* <p>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
Expand Down
Loading