public void testMissingRetainLineAfterDelete() {
{
doc = Document.createFromString("\n");
TextChange textChange = doc.deleteText(doc.getFirstLine(), 0, 1);
DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);
DocOp expected = b.d("\n").rl(1).b();
DocOpTestUtils.assertDocOpEquals(expected, docOp);
}
{
doc = Document.createFromString("alex\n");
TextChange textChange = doc.deleteText(doc.getFirstLine(), 4, 1);
DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);
DocOp expected = b.r(4).d("\n").rl(1).b();
DocOpTestUtils.assertDocOpEquals(expected, docOp);
}
{
doc = Document.createFromString("alex");
TextChange textChange = doc.insertText(doc.getFirstLine(), 4, "\n");
DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);
DocOp expected = b.r(4).i("\n").rl(1).b();
DocOpTestUtils.assertDocOpEquals(expected, docOp);
}
{
doc = Document.createFromString("alex\ntest");
TextChange textChange = doc.deleteText(doc.getFirstLine(), 0, 9);
DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);
DocOp expected = b.d("alex\n").d("test").rl(1).b();
DocOpTestUtils.assertDocOpEquals(expected, docOp);
}
}