Search in sources :

Example 1 with TwoChilds

use of org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.TwoChilds in project xtext-core by eclipse.

the class ChangeSerializerTest method testMoveElement_3.

@Test
public void testMoveElement_3() {
    InMemoryURIHandler fs = new InMemoryURIHandler();
    String content = "#24 direct:\n" + "	child:jumper\n";
    changeSerializerTestHelper.operator_add(fs, Pair.of("inmemory:/file-move3.pstl", content));
    ResourceSet rs = changeSerializerTestHelper.createResourceSet(fs);
    TwoChilds model = changeSerializerTestHelper.findFirstOfTypeInFile(rs, "inmemory:/file-move3.pstl", TwoChilds.class);
    IChangeSerializer serializer = changeSerializerTestHelper.newChangeSerializer();
    serializer.addModification(model.eResource(), (Resource it) -> {
        model.setDirectChild(model.getOptChild().getChild());
    });
    Collection<IEmfResourceChange> changes = changeSerializerTestHelper.endRecordChangesToTextDocuments(serializer);
    String expectation = "-------------- inmemory:/file-move3.pstl (syntax: <offset|text>) ---------------\n" + "<0:26|#24 direct:\n" + "	jumper\n" + "child :>\n" + "--------------------------------------------------------------------------------\n" + "0 26 \"#24 direct:\\n" + "	chil...\" -> \"#24 direct:\\n" + "	jump...\"\n";
    changeSerializerTestHelper.operator_tripleEquals(changes, expectation);
}
Also used : TwoChilds(org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.TwoChilds) IChangeSerializer(org.eclipse.xtext.ide.serializer.IChangeSerializer) InMemoryURIHandler(org.eclipse.xtext.testing.util.InMemoryURIHandler) Resource(org.eclipse.emf.ecore.resource.Resource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IEmfResourceChange(org.eclipse.xtext.ide.serializer.IEmfResourceChange) Test(org.junit.Test)

Aggregations

Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 IChangeSerializer (org.eclipse.xtext.ide.serializer.IChangeSerializer)1 IEmfResourceChange (org.eclipse.xtext.ide.serializer.IEmfResourceChange)1 TwoChilds (org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.TwoChilds)1 InMemoryURIHandler (org.eclipse.xtext.testing.util.InMemoryURIHandler)1 Test (org.junit.Test)1