aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwannheden2009-05-18 16:47:49 (EDT)
committersefftinge2009-05-18 16:47:49 (EDT)
commit134da4df4aaa995b4b2f9afa70784567032f6441 (patch)
treed22b450c86217d4c363fc4a43be93f1234d3dded
parentc25f92ae70391ff1e56d7648e26b22f1cf326e6c (diff)
downloadorg.eclipse.xtext-134da4df4aaa995b4b2f9afa70784567032f6441.zip
org.eclipse.xtext-134da4df4aaa995b4b2f9afa70784567032f6441.tar.gz
org.eclipse.xtext-134da4df4aaa995b4b2f9afa70784567032f6441.tar.bz2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=268791: added IXtext2EcorePostProcessor hook
-rwxr-xr-xtests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java
index 76d8c5e..6f987ef 100755
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/ecoreInference/Xtext2EcoreTransformerTest.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
import org.eclipse.xtext.AbstractRule;
+import org.eclipse.xtext.GeneratedMetamodel;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.ReferencedMetamodel;
@@ -1036,4 +1037,21 @@ public class Xtext2EcoreTransformerTest extends AbstractGeneratorTest {
XtextResource resource = getResourceFromString(grammar);
assertTrue(resource.getErrors().isEmpty());
}
+
+ public void testPostProcessorHook() throws Exception {
+ final String xtextGrammar = "grammar test with org.eclipse.xtext.common.Terminals" +
+ " import 'http://www.eclipse.org/emf/2002/Ecore' as ecore " +
+ " generate test 'http://test' MyRule: myFeature=INT;";
+ Grammar grammar = (Grammar) getModel(xtextGrammar);
+ Xtext2EcoreTransformer transformer = new Xtext2EcoreTransformer(grammar);
+ IXtext2EcorePostProcessor postProcessor = createMock(IXtext2EcorePostProcessor.class);
+ transformer.setPostProcessor(postProcessor);
+ GeneratedMetamodel testMetamodel = (GeneratedMetamodel) grammar.getMetamodelDeclarations().get(1);
+
+ postProcessor.process(testMetamodel);
+ replay(postProcessor);
+ transformer.transform();
+
+ verify(postProcessor);
+ }
}