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 1e44c4394..b2332ee15 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -1831,6 +1831,25 @@ class Test {} doFormatTest(input, expected); } + @Test + public void markdownLinkWrapping() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = +""" +/// enough text to cause the following link to need to be wrapped [foo](http://very.long/url/that/will/need/to/be/wrapped) +class Test {} +"""; + // It would be wrong to wrap between the ] and the (, and fortunately we don't. + // https://spec.commonmark.org/0.31.2/#example-511 + String expected = +""" +/// enough text to cause the following link to need to be wrapped +/// [foo](http://very.long/url/that/will/need/to/be/wrapped) +class Test {} +"""; + doFormatTest(input, expected); + } + @Test public void markdownThematicBreaks() { assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue();