use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testMoveTree4.
@Test
public void testMoveTree4() {
boolean exception = false;
try {
TextEdit root = new MultiTextEdit();
TextEdit e1 = new ReplaceEdit(0, 1, "");
root.addChild(e1);
e1.moveTree(1);
} catch (Exception e) {
exception = true;
}
assertTrue(exception);
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testCopy2.
@Test
public void testCopy2() throws Exception {
MultiTextEdit root = new MultiTextEdit();
CopySourceEdit s1 = new CopySourceEdit(5, 2);
CopyTargetEdit t1 = new CopyTargetEdit(8, s1);
CopySourceEdit s2 = new CopySourceEdit(5, 2);
CopyTargetEdit t2 = new CopyTargetEdit(2, s2);
s1.addChild(s2);
root.addChild(s1);
root.addChild(t1);
root.addChild(t2);
List<TextEdit> org = flatten(root);
TextEditCopier copier = new TextEditCopier(root);
List<TextEdit> copy = flatten(copier.perform());
compare(org, copy);
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testCovers2.
@Test
public void testCovers2() throws Exception {
MultiTextEdit multi = new MultiTextEdit(0, 0);
MultiTextEdit child = new MultiTextEdit(0, 0);
Assert.assertEquals(true, multi.covers(child));
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testUndefinedMultiEdit1.
@Test
public void testUndefinedMultiEdit1() throws Exception {
MultiTextEdit m1 = new MultiTextEdit();
m1.addChild(new InsertEdit(0, ""));
fRoot.addChild(m1);
MultiTextEdit m2 = new MultiTextEdit();
m2.addChild(new InsertEdit(2, ""));
fRoot.addChild(m2);
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testBufferLength.
@Test
public void testBufferLength() throws Exception {
MultiTextEdit edit = new MultiTextEdit(0, fDocument.getLength() + 1);
boolean exception = false;
try {
fRoot.addChild(edit);
fRoot.apply(fDocument);
} catch (MalformedTreeException e) {
exception = true;
assertTrue(exception);
}
}
Aggregations