Skip to content

Commit 05a59dd

Browse files
fedejeannejukzi
authored andcommitted
Add regression test for eclipse-jdt#1992
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
1 parent 441cca8 commit 05a59dd

File tree

1 file changed

+11
-8
lines changed
  • org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/folding

1 file changed

+11
-8
lines changed

org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/folding/FoldingTest.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,21 @@ class SomeClass {}
288288
public void testMethodDeclarationFoldingWithSameLineStart() throws Exception {
289289
String str= """
290290
package org.example.test;
291-
public class Q {
292-
void a() {
293-
int i = 0;
294-
}void b() {
291+
class X {
292+
/* //here should be an annotation
293+
* a b
294+
*/
295+
void a() { //here should be an annotation
295296
296-
}
297+
} void b() { //here should be an annotation
298+
}
297299
}
298300
""";
299-
FoldingTestUtils.assertCodeHasRegions(packageFragment, "TestFolding.java", str, 2);
301+
FoldingTestUtils.assertCodeHasRegions(packageFragment, "TestFolding.java", str, 3);
300302
List<IRegion> regions= FoldingTestUtils.getProjectionRangesOfFile(packageFragment, "TestFolding.java", str);
301-
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 2, 3); // 1. Method
302-
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 4, 5); // 2. Method
303+
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 2, 4); // JavaDoc
304+
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 5, 6); // 1. Method
305+
FoldingTestUtils.assertContainsRegionUsingStartAndEndLine(regions, str, 7, 7); // 2. Method
303306
}
304307

305308
@Test

0 commit comments

Comments
 (0)