use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkRightAfter.
@Test
public void testHunkRightAfter() throws Exception {
ChangeRegion r = new ChangeRegion(fRevision, new LineRange(12, 3));
List<Range> before = RangeUtil.deepClone(r.getAdjustedRanges());
r.adjustTo(new Hunk(15, 3, 2));
RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
RangeUtil.assertEqualRange(before.get(0), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
before = RangeUtil.deepClone(r.getAdjustedRanges());
r.adjustTo(new Hunk(15, -3, 2));
RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
RangeUtil.assertEqualRange(before.get(0), r.getAdjustedCoverage());
}
use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkAtEnd.
@Test
public void testHunkAtEnd() throws Exception {
ChangeRegion r;
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, 0, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, 2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, -2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, -2, 0));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
}
use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkOverStart.
@Test
public void testHunkOverStart() throws Exception {
ChangeRegion r;
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, 0, 2));
RangeUtil.assertEqualSingleRange(new LineRange(13, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(13, 6), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, 2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(15, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 6), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, -2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(13, 4), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(13, 4), r.getAdjustedCoverage());
}
use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkOverEnd.
@Test
public void testHunkOverEnd() throws Exception {
ChangeRegion r;
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(18, 0, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(18, -2, 0));
RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(18, -2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, -2, 1));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, -2, 3));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, 2, 3));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
}
use of org.eclipse.jface.internal.text.revisions.Hunk in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testHunkBefore.
@Test
public void testHunkBefore() throws Exception {
ChangeRegion r;
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, 3, 2));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, 3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, -3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(9, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, 3, 3));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
r = new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, -3, 2));
RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(9, 3), r.getAdjustedCoverage());
}
Aggregations