Skip to content

Commit 2a7a21f

Browse files
javadoc Markdown issues (eclipse-jdt#2052)
Regards issue 1800 (9), handling of array references within code: Test added for fix in eclipse-jdt/eclipse.jdt.core#3761 Relates to eclipse-jdt#1800
1 parent 2f3b85a commit 2a7a21f

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/MarkdownCommentTests.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,4 +958,45 @@ public int foo(int i) {
958958
String actualHtmlContent= getHoverHtmlContent(cu, method);
959959
assertHtmlContent(expectedContent, actualHtmlContent);
960960
}
961+
962+
963+
@Test
964+
public void testArrayReferenceInCode() throws CoreException {
965+
String source= """
966+
/// In the following indented code block, `[i]` is program text,
967+
/// and not a hyper link:
968+
///
969+
/// int i = 3;
970+
/// int[] d = new int[i];
971+
///
972+
/// Likewise, in the following fenced code block, `[i]` is program text,
973+
/// and not a hyper link:
974+
///
975+
/// ```
976+
/// int i = 3;
977+
/// int[] d = new int[i];
978+
/// ```
979+
public class ArrayInCode {
980+
}
981+
""";
982+
ICompilationUnit cu= getWorkingCopy("/TestSetupProject/src/p/ArrayInCode.java", source, null);
983+
assertNotNull("ArrayInCode.java", cu);
984+
985+
String expectedContent= """
986+
<p>In the following indented code block, <code>[i]</code> is program text,
987+
and not a hyper link:</p>
988+
<pre><code>int i = 3;
989+
int[] d = new int[i];
990+
</code></pre>
991+
<p>Likewise, in the following fenced code block, <code>[i]</code> is program text,
992+
and not a hyper link:</p>
993+
<pre><code>int i = 3;
994+
int[] d = new int[i];
995+
</code></pre>
996+
""";
997+
IType type= cu.getType("ArrayInCode");
998+
String actualHtmlContent= getHoverHtmlContent(cu, type);
999+
assertHtmlContent(expectedContent, actualHtmlContent);
1000+
}
1001+
9611002
}

0 commit comments

Comments
 (0)