From 332aa07430cd33c6cdc2bac6e5b13b24815cabc5 Mon Sep 17 00:00:00 2001 From: Louis Vignier Date: Mon, 29 Sep 2025 17:24:09 +0200 Subject: [PATCH] [javadoc] Add markdown code block formatter tests IJ-CR-176793 GitOrigin-RevId: e5eeeb40490d99ba3a78fc4e856b7c18dbc686a3 --- .../formatter/java/JavadocFormatterTest.kt | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavadocFormatterTest.kt b/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavadocFormatterTest.kt index f56a4f0d17fb..bb8d89484d30 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavadocFormatterTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/psi/formatter/java/JavadocFormatterTest.kt @@ -2314,20 +2314,51 @@ public class Test { RIGHT_MARGIN = 120 } - doTextTest(""" + val before = """ /// only this should be reformated /// ```java /// @Annotation public static final @Annotation2 List myList = List.of("a", "b", "c"); /// ``` public class Foo { } - """.trimIndent(), """ + """.trimIndent() + + val after = """ /// only this should be reformated /// ```java /// @Annotation public static final @Annotation2 List myList = List.of("a", "b", "c"); /// ``` public class Foo { } - """.trimIndent()) + """.trimIndent() + + doTextTest(before, after) + doTextTest(after, after) + } + + fun testMarkdownTildeCodeBlock() { + settings.apply { + WRAP_COMMENTS = true + RIGHT_MARGIN = 120 + } + + val before = """ + /// only this should be reformated + /// ~~~java ~ + /// @Annotation public static final @Annotation2 List myList = List.of("a", "b", "c"); + /// ~~~ + public class Foo { + } + """.trimIndent() + val after = """ + /// only this should be reformated + /// ~~~java ~ + /// @Annotation public static final @Annotation2 List myList = List.of("a", "b", "c"); + /// ~~~ + public class Foo { + } + """.trimIndent() + doTextTest(before, after) + doTextTest(after, after) } } \ No newline at end of file