Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Huebner2016-01-27 12:55:45 +0000
committerDennis Huebner2016-01-27 13:28:09 +0000
commit7cfead6978f4739f3bace34dba31dd290446e430 (patch)
treee56546dc0e979f9dc391ac32a61c6d1d74cd0c96 /tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test
parent595234353bea2692e188d72d1a768a12dc3c9452 (diff)
downloadorg.eclipse.emf-7cfead6978f4739f3bace34dba31dd290446e430.tar.gz
org.eclipse.emf-7cfead6978f4739f3bace34dba31dd290446e430.tar.xz
org.eclipse.emf-7cfead6978f4739f3bace34dba31dd290446e430.zip
[479585] The default genmodel java level in non-eclipse case
Change-Id: I8cbfd5b7c8d8bfd7c72274ee0f405f742165fc76 Signed-off-by: Dennis Huebner <dennis.huebner@gmail.com>
Diffstat (limited to 'tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test')
-rw-r--r--tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/interpreter/XcoreInterpreterTest.xtend37
1 files changed, 34 insertions, 3 deletions
diff --git a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/interpreter/XcoreInterpreterTest.xtend b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/interpreter/XcoreInterpreterTest.xtend
index c6ae8780a..14f9f50aa 100644
--- a/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/interpreter/XcoreInterpreterTest.xtend
+++ b/tests/org.eclipse.emf.test.ecore.xcore/src/org/eclipse/emf/test/ecore/xcore/interpreter/XcoreInterpreterTest.xtend
@@ -136,9 +136,10 @@ class XcoreInterpreterTest {
assertEquals("Sven", foo.eGet(fooClass.getEStructuralFeature("alias")));
}
@Test
- def void testEnum() {
+ def void testEnumJDK14() {
val pack = parse.parse('''
- package foo.bar
+ @GenModel(complianceLevel="1.4")
+ package foo.bar14
enum NodeKind { Singleton Root Intermediate Leaf }
class Node
{
@@ -148,7 +149,7 @@ class XcoreInterpreterTest {
transient volatile derived readonly NodeKind nodeKind
get
{
- if (hasChildren()) {if (parent == null) {NodeKind::ROOT_LITERAL} else {NodeKind::INTERMEDIATE_LITERAL}}
+ if (hasChildren()) {if (parent == null) {NodeKind::ROOT_LITERAL} else {NodeKind.INTERMEDIATE_LITERAL}}
else {if (parent == null) {NodeKind::SINGLETON_LITERAL} else {NodeKind::LEAF_LITERAL}}
}
}
@@ -163,4 +164,34 @@ class XcoreInterpreterTest {
(node.eGet(nodeClass.getEStructuralFeature("children")) as List<EObject>).add(childNode);
assertEquals(nodeKindEnum.getEEnumLiteral("Root"), node.eGet(nodeClass.getEStructuralFeature("nodeKind")));
}
+
+ @Test
+ def void testEnumJDK50() {
+ val pack = parse.parse('''
+ @GenModel(complianceLevel="5.0")
+ package foo.bar15
+ enum NodeKind { Singleton Root Intermediate Leaf }
+ class Node
+ {
+ refers Node parent opposite children
+ contains Node[0..*] children opposite parent
+ op boolean hasChildren() { !children.empty }
+ transient volatile derived readonly NodeKind nodeKind
+ get
+ {
+ if (hasChildren()) {if (parent == null) {NodeKind::ROOT} else {NodeKind.INTERMEDIATE}}
+ else {if (parent == null) {NodeKind::SINGLETON} else {NodeKind::LEAF}}
+ }
+ }
+ ''')
+ validator.assertNoErrors(pack)
+ val ePackage = pack.eResource.contents.get(2) as EPackage
+ val nodeKindEnum = ePackage.getEClassifier("NodeKind") as EEnum
+ val nodeClass = ePackage.getEClassifier("Node") as EClass
+ val node = ePackage.EFactoryInstance.create(nodeClass)
+ assertEquals(nodeKindEnum.getEEnumLiteral("Singleton"), node.eGet(nodeClass.getEStructuralFeature("nodeKind")));
+ val childNode = ePackage.EFactoryInstance.create(nodeClass)
+ (node.eGet(nodeClass.getEStructuralFeature("children")) as List<EObject>).add(childNode);
+ assertEquals(nodeKindEnum.getEEnumLiteral("Root"), node.eGet(nodeClass.getEStructuralFeature("nodeKind")));
+ }
} \ No newline at end of file

Back to the top