Search in sources :

Example 6 with Element

use of org.eclipse.xtext.parsetree.impl.commentAssociation.Element in project xtext-core by eclipse.

the class CommentAssociationTest method testSerializeReplacement.

// TODO https://github.com/eclipse/xtext-core/issues/32
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475457
@Ignore
@Test
public void testSerializeReplacement() throws Exception {
    String xBlock = "// comment pre x\n" + "element /* comment inside x */ x // comment post x\n" + "";
    String yBlock = "// comment pre y\n" + "element /* comment inside y */ y // comment post y\n" + "";
    String zBlock = "// comment pre z\n" + "element z";
    String textModel = xBlock + yBlock + zBlock;
    Model model = (Model) getModel(textModel);
    EList<Element> elements = model.getElements();
    Element x = elements.get(0);
    Element y = elements.get(1);
    Element z = elements.get(2);
    checkReplaceRegion(x, xBlock, textModel);
    checkReplaceRegion(y, yBlock, textModel);
    checkReplaceRegion(z, zBlock, textModel);
}
Also used : Element(org.eclipse.xtext.parsetree.impl.commentAssociation.Element) Model(org.eclipse.xtext.parsetree.impl.commentAssociation.Model) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with Element

use of org.eclipse.xtext.parsetree.impl.commentAssociation.Element in project xtext-core by eclipse.

the class CommentAssociationTest method testCommentAssociationAtEndOfFile.

@Test
public void testCommentAssociationAtEndOfFile() throws Exception {
    String textModel = "element x // comment post x";
    Model model = (Model) getModel(textModel);
    Multimap<EObject, String> multimap = createModel2CommentMap(model);
    EList<Element> elements = model.getElements();
    Element x = elements.get(0);
    checkComments(multimap, x, "// comment post x");
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Element(org.eclipse.xtext.parsetree.impl.commentAssociation.Element) Model(org.eclipse.xtext.parsetree.impl.commentAssociation.Model) Test(org.junit.Test)

Aggregations

Element (org.eclipse.xtext.parsetree.impl.commentAssociation.Element)7 Model (org.eclipse.xtext.parsetree.impl.commentAssociation.Model)6 Test (org.junit.Test)5 EObject (org.eclipse.emf.ecore.EObject)3 EPackage (org.eclipse.emf.ecore.EPackage)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 Ignore (org.junit.Ignore)1