From 6b68963ff800f297507d0870051e39ae8291e78e Mon Sep 17 00:00:00 2001 From: Kurt Alfred Kluever Date: Wed, 29 Jul 2026 10:55:51 -0700 Subject: [PATCH] Add repro test for markdown Javadoc MOE comment formatting Add a test in `JavadocFormattingTest` to verify formatting of markdown Javadoc (`///`) comments containing MOE intracomment strip tags and fenced code blocks. PiperOrigin-RevId: 955974062 --- .../java/JavadocFormattingTest.java | 37 +++++++++++++++++++ 1 file changed, 37 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 fd0c96b75..60f59bdc4 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -1847,6 +1847,43 @@ class Test {} doFormatTest(input, expected); } + @Test + public void markdownMoeComments() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = + """ + /// This is the first line. + /// + /// + /// This is a comment that should be stripped + /// + /// ``` + /// this is a code block + /// ``` + /// + class Test {} + """ + .replace("moe", "MOE"); + // TODO(kak): Ideally the extra blank lines would not be inserted after the code block + String expected = + """ + /// This is the first line. + /// + /// + /// This is a comment that should be stripped + /// + /// ``` + /// this is a code block + /// ``` + /// + /// + /// + class Test {} + """ + .replace("moe", "MOE"); + doFormatTest(input, expected); + } + @Test public void markdownBackslashes() { assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue();