Skip to content

Commit

Permalink
Add regression test for eclipse-jdt#1992
Browse files Browse the repository at this point in the history
For eclipse-jdt#2014. I modified
an existing test to also cover the issue that was fixed by that PR.

Contributes to eclipse-jdt#1992
  • Loading branch information
fedejeanne committed Feb 14, 2025
1 parent c8f7146 commit 1c94e11
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,21 @@ class SomeClass {}
public void testMethodDeclarationFoldingWithSameLineStart() throws Exception {
String str= """
package org.example.test;
public class Q {
void a() {
int i = 0;
}void b() {
class X {
/* //here should be an annotation
* a b
*/
void a() { //here should be an annotation
}
} void b() { //here should be an annotation
}
}
""";
FoldingTestUtils.assertCodeHasRegions(packageFragment, "TestFolding.java", str, 2);
FoldingTestUtils.assertCodeHasRegions(packageFragment, "TestFolding.java", str, 3);
List<IRegion> regions= FoldingTestUtils.getProjectionRangesOfFile(packageFragment, "TestFolding.java", str);
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 2, 3); // 1. Method
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 4, 5); // 2. Method
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 2, 4); // JavaDoc
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 5, 6); // 1. Method
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 7, 7); // 2. Method
}

@Test
Expand Down

0 comments on commit 1c94e11

Please sign in to comment.