use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method insertSingleLineNoEOLInTheMiddle.
@Test
public void insertSingleLineNoEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 5, 1, 5, "Abc");
assertThat(fixResult).text().isEqualTo("FirstAbc line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isInsert(5, 5, 3);
}
use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method replaceMultilineLineNoEOLAtStart.
@Test
public void replaceMultilineLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 0, 1, 2, "Abc\nDefgh");
assertThat(fixResult).text().isEqualTo("Abc\nDefghrst line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 2);
assertThat(edit).internalEdits().onlyElement().isReplace(0, 2, 0, 9);
}
use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method replaceWithSingleLineWithEOLInTheMiddle.
@Test
public void replaceWithSingleLineWithEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 3, 1, 5, "Abc\n");
assertThat(fixResult).text().isEqualTo("FirAbc\n line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 2);
assertThat(edit).internalEdits().onlyElement().isReplace(3, 2, 3, 4);
}
use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method replaceWithSingleLineNoEOLAtStart.
@Test
public void replaceWithSingleLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 0, 1, 2, "Abc");
assertThat(fixResult).text().isEqualTo("Abcrst line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isReplace(0, 2, 0, 3);
}
use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method insertSingleLineNoEOLInTheMiddle.
@Test
public void insertSingleLineNoEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 5, 1, 5, "Abc");
assertThat(fixResult).text().isEqualTo("FirstAbc line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isInsert(5, 5, 3);
}
Aggregations