use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Simple in project xtext-core by eclipse.
the class RegionAccessDiffTest method testSingleSemanticToken.
@Test
public void testSingleSemanticToken() throws Exception {
String model = "1 foo\n";
ITextRegionAccess access = regionAccessTestHelper.toTextRegionAccess(model);
ITextRegionAccess modifiedAccess = regionAccessTestHelper.modify(access, (ITextRegionDiffBuilder it) -> {
ITextRegionExtensions ext = access.getExtensions();
EObject root = access.regionForRootEObject().getSemanticElement();
ISemanticRegion foo = ext.allRegionsFor(root).feature(RegionaccesstestlanguagePackage.Literals.SIMPLE__NAME);
it.replace(foo, "baaar");
});
String expectation = "0 0 H\n" + " B Simple'foo' Root\n" + "0 1 S \"1\" Simple:'1'\n" + "1 1 H \" \" Whitespace:TerminalRule'WS'\n" + "2 5 1 S \"baaar\" Simple:name=ID\n" + " E Simple'foo' Root\n" + "7 0 H\n" + "------------ diff 1 ------------\n" + "2 3 S \"foo\" Simple:name=ID\n";
regionAccessTestHelper.assertRegions(modifiedAccess, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Simple in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testMultiWhitespace2.
@Test
public void testMultiWhitespace2() throws Exception {
String model = "1\n" + "/**/\n" + "foo\n".trim();
String expectation = " 0 0 H\n" + " B Simple'foo' Root\n" + " 0 1 S \"1\" Simple:'1'\n" + " 1 H \"\\n" + "\" Whitespace:TerminalRule'WS'\n" + " \"/**/\" Comment:TerminalRule'ML_COMMENT' Association:NEXT\n" + " 6 \"\\n" + "\" Whitespace:TerminalRule'WS'\n" + " 7 3 S \"foo\" Simple:name=ID\n" + " E Simple'foo' Root\n" + "10 0 H\n";
assertRegions(model, expectation);
}
Aggregations