use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method operator_tripleEquals.
private void operator_tripleEquals(final CharSequence file, final CharSequence expectation) {
try {
final String exp = expectation.toString();
final Root obj = this.parseHelper.parse(file);
this.validationTestHelper.assertNoErrors(obj);
final ITextRegionAccess access1 = this.createFromNodeModel(obj);
final ITextRegionAccess access2 = this.serializer.serializeToRegions(obj);
this.assertToStringDoesNotCrash(access1);
this.assertToStringDoesNotCrash(access2);
this.assertLinesAreConsistent(access1);
this.assertLinesAreConsistent(access2);
TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access1));
final String tra1 = (_cfg + "\n");
TextRegionAccessToString _cfg_1 = this.cfg(new TextRegionAccessToString().withRegionAccess(access2));
final String tra2 = (_cfg_1 + "\n");
Assert.assertEquals(Strings.toPlatformLineSeparator(exp), Strings.toPlatformLineSeparator(tra1));
Assert.assertEquals(Strings.toPlatformLineSeparator(exp), Strings.toPlatformLineSeparator(tra2));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testComments1.
@Test
public void testComments1() throws Exception {
String model = "/*xxxx*/\n" + "8\n" + "/*aaaaa*/\n" + "c\n" + "// last\n".trim();
String expectation = " 0 H \"/*xxxx*/\" Comment:TerminalRule'ML_COMMENT' Association:NEXT\n" + " 9 \"\\n" + "\" Whitespace:TerminalRule'WS'\n" + " B ValueList'[c]' Root\n" + " 9 1 S \"8\" Root:'8'\n" + "10 H \"\\n" + "\" Whitespace:TerminalRule'WS'\n" + " \"/*aaa...\" Comment:TerminalRule'ML_COMMENT' Association:NEXT\n" + " 11 \"\\n" + "\" Whitespace:TerminalRule'WS'\n" + "21 1 S \"c\" ValueList:name+=ID\n" + " E ValueList'[c]' Root\n" + "22 H \"\\n" + "\" Whitespace:TerminalRule'WS'\n" + " 8 \"// last\" Comment:TerminalRule'SL_COMMENT' Association:CONTAINER\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testAssignmentChildDelegate2.
@Test
public void testAssignmentChildDelegate2() throws Exception {
String model = "6 (child(((foo))))\n".trim();
String expectation = " 0 0 H\n" + " B Mixed Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 5 S \"child\" Mixed:'child'\n" + " 8 0 H\n" + " B Mixed'foo' Mixed:eobj=Mixed path:Mixed/eobj\n" + " 8 1 S \"(\" Mixed:'('\n" + " 9 0 H\n" + " 9 1 S \"(\" Mixed:'('\n" + "10 0 H\n" + "10 1 S \"(\" Mixed:'('\n" + "11 0 H\n" + "11 3 S \"foo\" Mixed:name=ID\n" + "14 0 H\n" + "14 1 S \")\" Mixed:')'\n" + "15 0 H\n" + "15 1 S \")\" Mixed:')'\n" + "16 0 H\n" + "16 1 S \")\" Mixed:')'\n" + " E Mixed'foo' Mixed:eobj=Mixed path:Mixed/eobj\n" + "17 0 H\n" + "17 1 S \")\" Mixed:')'\n" + " E Mixed Root\n" + "18 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testFragmentID.
@Test
public void testFragmentID() throws Exception {
String model = "6 (fragment foo)\n".trim();
String expectation = " 0 0 H\n" + " B Action Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 8 S \"fragment\" Mixed:'fragment'\n" + "11 1 H \" \" Whitespace:TerminalRule'WS'\n" + "12 3 S \"foo\" Fragment:fragName=ID\n" + "15 0 H\n" + "15 1 S \")\" Mixed:')'\n" + " E Action Root\n" + "16 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testFragmentChildAction.
@Test
public void testFragmentChildAction() throws Exception {
String model = "6 (fragment child ())\n".trim();
String expectation = " 0 0 H\n" + " B Action Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 8 S \"fragment\" Mixed:'fragment'\n" + "11 1 H \" \" Whitespace:TerminalRule'WS'\n" + "12 5 S \"child\" Fragment:'child'\n" + "17 1 H \" \" Whitespace:TerminalRule'WS'\n" + " B Action Fragment:mixed=Mixed path:Action/mixed\n" + "18 1 S \"(\" Mixed:'('\n" + "19 0 H\n" + "19 1 S \")\" Mixed:')'\n" + " E Action Fragment:mixed=Mixed path:Action/mixed\n" + "20 0 H\n" + "20 1 S \")\" Mixed:')'\n" + " E Action Root\n" + "21 0 H\n";
assertRegions(model, expectation);
}
Aggregations