Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.qvtd.doc.minioclcs.xtext.tests/src/org/eclipse/qvtd/doc/minioclcs/xtext/tests/MiniOCLCSParsingTest.xtend')
-rw-r--r--tests/org.eclipse.qvtd.doc.minioclcs.xtext.tests/src/org/eclipse/qvtd/doc/minioclcs/xtext/tests/MiniOCLCSParsingTest.xtend66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/org.eclipse.qvtd.doc.minioclcs.xtext.tests/src/org/eclipse/qvtd/doc/minioclcs/xtext/tests/MiniOCLCSParsingTest.xtend b/tests/org.eclipse.qvtd.doc.minioclcs.xtext.tests/src/org/eclipse/qvtd/doc/minioclcs/xtext/tests/MiniOCLCSParsingTest.xtend
new file mode 100644
index 000000000..502e067ea
--- /dev/null
+++ b/tests/org.eclipse.qvtd.doc.minioclcs.xtext.tests/src/org/eclipse/qvtd/doc/minioclcs/xtext/tests/MiniOCLCSParsingTest.xtend
@@ -0,0 +1,66 @@
+/*
+ * generated by Xtext 2.10.0-SNAPSHOT
+ */
+package org.eclipse.qvtd.doc.minioclcs.xtext.tests
+
+import com.google.inject.Inject
+import org.eclipse.xtext.junit4.InjectWith
+import org.eclipse.xtext.junit4.XtextRunner
+import org.eclipse.xtext.junit4.util.ParseHelper
+import org.junit.Assert
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.eclipse.qvtd.doc.minioclcs.RootCS
+import junit.framework.TestCase
+
+@RunWith(XtextRunner)
+@InjectWith(MiniOCLCSInjectorProvider)
+class MiniOCLCSParsingTest extends TestCase {
+
+ @Inject
+ ParseHelper<RootCS> parseHelper
+
+ @Test
+ def void testSimpleMiniOCL_PackagesDef() {
+ val result = parseHelper.parse('''
+ package ocl {
+
+ class String {}
+ }
+
+ package package1 {
+
+ class c1 {
+ prop a : ocl::String;
+ op getA() : ocl::String = a;
+ }
+ }
+
+ ''')
+ Assert.assertNotNull(result)
+ }
+
+ @Test
+ def void testSimpleMiniOCL_Invariant() {
+ val result = parseHelper.parse('''
+ package package1 {
+
+ class c1 {
+
+ prop a : String;
+
+ op giveMeA() : String = self.c1;
+
+ op testA() : Boolean = giveMeA().size() <> 0;
+ }
+ }
+
+ context package1::c1 {
+ inv : a = giveMeA();
+ inv : testA();
+ }
+ ''')
+ Assert.assertNotNull(result)
+ }
+
+}

Back to the top