use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testTreeIterator_Previous.
@Test
public void testTreeIterator_Previous() {
ICompositeNode rootNode = builder.newRootNode("input");
AbstractNode node = createNode();
builder.addChild(rootNode, node);
BidiIterator<INode> iterator = node.iterator();
assertTrue(iterator.hasPrevious());
assertSame(node, iterator.previous());
assertFalse(iterator.hasPrevious());
try {
iterator.previous();
fail("Expected NoSuchElementException");
} catch (NoSuchElementException e) {
// ok
}
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testTreeIterator_Bidi.
@Test
public void testTreeIterator_Bidi() {
ICompositeNode rootNode = builder.newRootNode("input");
AbstractNode node = createNode();
builder.addChild(rootNode, node);
BidiIterator<INode> iterator = node.iterator();
assertSame(node, iterator.next());
assertTrue(iterator.hasPrevious());
assertSame(node, iterator.previous());
assertTrue(iterator.hasNext());
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testGetRootNode_Parent.
@Test
public void testGetRootNode_Parent() {
AbstractNode node = createNode();
ICompositeNode rootNode = builder.newRootNode("My input");
ICompositeNode parent = builder.newCompositeNode(null, 0, rootNode);
builder.addChild(parent, node);
assertSame(rootNode, node.getRootNode());
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testTreeIterator_Previous_NoParent.
@Test
public void testTreeIterator_Previous_NoParent() {
AbstractNode node = createNode();
BidiIterator<INode> iterator = node.iterator();
assertTrue(iterator.hasPrevious());
assertSame(node, iterator.previous());
assertFalse(iterator.hasPrevious());
try {
iterator.previous();
fail("Expected NoSuchElementException");
} catch (NoSuchElementException e) {
// ok
}
}
use of org.eclipse.xtext.nodemodel.impl.AbstractNode in project xtext-core by eclipse.
the class AbstractNodeTest method testGetText_NoParent.
@Test
public void testGetText_NoParent() {
AbstractNode node = createNode();
assertNull(node.getText());
}
Aggregations