use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testTwoRootNodes.
@Test
public void testTwoRootNodes() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("first");
_builder.newLine();
_builder.append("second");
_builder.newLine();
final Tree tree = this.parse(_builder);
Assert.assertNotNull(tree);
Assert.assertEquals(2, tree.getNodes().size());
Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
Assert.assertEquals("second", IterableExtensions.<TreeNode>last(tree.getNodes()).getName());
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testIgnoreEmptyLines_3.
@Test
public void testIgnoreEmptyLines_3() {
final Tree tree = this.parse("first\n\t");
Assert.assertNotNull(tree);
Assert.assertEquals(1, tree.getNodes().size());
Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
Assert.assertEquals(0, IterableExtensions.<TreeNode>head(tree.getNodes()).getChildren().size());
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testIgnoreEmptyLines_5.
@Test
public void testIgnoreEmptyLines_5() {
final Tree tree = this.parse("first\n\t\tabc\n\t");
Assert.assertNotNull(tree);
Assert.assertEquals(1, tree.getNodes().size());
Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
Assert.assertEquals(1, IterableExtensions.<TreeNode>head(tree.getNodes()).getChildren().size());
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testParentChildren.
@Test
public void testParentChildren() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("parent");
_builder.newLine();
_builder.append("\t");
_builder.append("child");
_builder.newLine();
_builder.append("\t");
_builder.append("child");
_builder.newLine();
final Tree tree = this.parse(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("parent");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("child");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("child");
_builder_1.newLine();
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testTree_08.
@Test
public void testTree_08() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\"a\"");
_builder.newLine();
_builder.append("\t");
_builder.append("\"1\"");
_builder.newLine();
_builder.append("\t");
_builder.append("\"2\"");
_builder.newLine();
_builder.append("\"b\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\"3\"");
_builder.newLine();
final Tree tree = this.parseAndValidate(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("a");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append(">");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("1");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("2");
_builder_1.newLine();
_builder_1.append("b");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append(">");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("3");
_builder_1.newLine();
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
}
Aggregations