Skip to content

Commit

Permalink
164: test for existing EClass
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed May 14, 2020
1 parent 8c7c28c commit c70af1c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,28 @@ class EdeltaInterpreterTest extends EdeltaAbstractTest {
]
}
@Test def void testEcoreRefExpForExistingEClass() {
'''
import org.eclipse.emf.ecore.EcoreFactory

metamodel "foo"

modifyEcore aTest epackage foo {
ecoreref(FooClass)
}
'''.parseWithTestEcore => [
interpretProgram
val ecoreRefs = allEcoreReferenceExpressions
ecoreRefs.head => [
val exp = derivedStateHelper
.getEcoreReferenceExpressionState(it)
.getEnamedElementXExpressionMap
.get(reference.enamedelement)
assertNull(exp)
]
]
}
@Test def void testEcoreRefExpForCreatedEClassRenamedInInitializer() {
'''
import org.eclipse.emf.ecore.EcoreFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,36 @@ public void testEcoreRefExpForCreatedEClassRenamed() {
ObjectExtensions.<EdeltaProgram>operator_doubleArrow(_parseWithTestEcore, _function);
}

@Test
public void testEcoreRefExpForExistingEClass() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("import org.eclipse.emf.ecore.EcoreFactory");
_builder.newLine();
_builder.newLine();
_builder.append("metamodel \"foo\"");
_builder.newLine();
_builder.newLine();
_builder.append("modifyEcore aTest epackage foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("ecoreref(FooClass)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
EdeltaProgram _parseWithTestEcore = this.parseWithTestEcore(_builder);
final Procedure1<EdeltaProgram> _function = (EdeltaProgram it) -> {
this.interpretProgram(it);
final List<EdeltaEcoreReferenceExpression> ecoreRefs = this.getAllEcoreReferenceExpressions(it);
EdeltaEcoreReferenceExpression _head = IterableExtensions.<EdeltaEcoreReferenceExpression>head(ecoreRefs);
final Procedure1<EdeltaEcoreReferenceExpression> _function_1 = (EdeltaEcoreReferenceExpression it_1) -> {
final XExpression exp = this.derivedStateHelper.getEcoreReferenceExpressionState(it_1).getEnamedElementXExpressionMap().get(it_1.getReference().getEnamedelement());
Assert.assertNull(exp);
};
ObjectExtensions.<EdeltaEcoreReferenceExpression>operator_doubleArrow(_head, _function_1);
};
ObjectExtensions.<EdeltaProgram>operator_doubleArrow(_parseWithTestEcore, _function);
}

@Test
public void testEcoreRefExpForCreatedEClassRenamedInInitializer() {
StringConcatenation _builder = new StringConcatenation();
Expand Down

0 comments on commit c70af1c

Please sign in to comment.