use of org.eclipse.jface.text.source.LineRange in project eclipse.platform.text by eclipse.
the class ChangeRegionTest method testCreation.
@Test
public void testCreation() throws Exception {
try {
new ChangeRegion(fRevision, null);
fail();
} catch (Exception e) {
}
try {
new ChangeRegion(null, new LineRange(12, 3));
fail();
} catch (Exception e) {
}
try {
new ChangeRegion(null, null);
fail();
} catch (Exception e) {
}
ChangeRegion r = new ChangeRegion(fRevision, new LineRange(12, 3));
assertEquals(fRevision, r.getRevision());
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedRanges().get(0));
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
}
use of org.eclipse.jface.text.source.LineRange 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.text.source.LineRange 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.text.source.LineRange 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.text.source.LineRange 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());
}
Aggregations