summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-04-20 02:43:07 (EDT)
committer sefftinge2009-04-20 02:43:07 (EDT)
commitbac47c27fb1201250b869ef1f8ec6ce16c473e8e (patch)
tree55d0cede0beda7304517b43d82797982785df35a
parent3d67dcd8e4cb55df528232071c6a867116499ac7 (diff)
downloadorg.eclipse.xtext-bac47c27fb1201250b869ef1f8ec6ce16c473e8e.zip
org.eclipse.xtext-bac47c27fb1201250b869ef1f8ec6ce16c473e8e.tar.gz
org.eclipse.xtext-bac47c27fb1201250b869ef1f8ec6ce16c473e8e.tar.bz2
Fix: https://bugs.eclipse.org/bugs/show_bug.cgi?id=270963
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java1
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/grammarinheritance/InheritanceTest.java12
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextScopingTest.java1
3 files changed, 2 insertions, 12 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java
index 1db3ff2..4366480 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java
@@ -94,6 +94,7 @@ public class PluginTestSuite {
suite.addTestSuite(org.eclipse.xtext.xtext.ResourceLoadTest.class);
suite.addTestSuite(org.eclipse.xtext.xtext.parser.packrat.XtextPackratParserTest.class);
suite.addTestSuite(org.eclipse.xtext.xtext.XtextValidationTest.class);
+ suite.addTestSuite(org.eclipse.xtext.xtext.XtextScopingTest.class);
return suite;
}
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/grammarinheritance/InheritanceTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/grammarinheritance/InheritanceTest.java
index 615b733..138a5f3 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/grammarinheritance/InheritanceTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/grammarinheritance/InheritanceTest.java
@@ -18,11 +18,8 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.GrammarUtil;
-import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.TypeRef;
-import org.eclipse.xtext.crossref.ILinkingService;
import org.eclipse.xtext.grammarinheritance.ametamodel.AmetamodelPackage;
-import org.eclipse.xtext.grammarinheritance.services.ConcreteTestLanguageGrammarAccess;
import org.eclipse.xtext.tests.AbstractGeneratorTest;
import com.google.common.base.Function;
@@ -66,13 +63,4 @@ public class InheritanceTest extends AbstractGeneratorTest {
}
assertTrue(expectedNames.toString(), expectedNames.isEmpty());
}
-
- //see https://bugs.eclipse.org/bugs/show_bug.cgi?id=270963
- public void _testScoping() {
- ILinkingService l = getLinkingService();
- ConcreteTestLanguageGrammarAccess ga = (ConcreteTestLanguageGrammarAccess) getGrammarAccess();
- RuleCall rc = ga.getAbstractCallOverridenParserRuleAccess().getElementsOverridableParserRuleParserRuleCall_1_0();
- String ref = l.getLinkText(rc.getRule(), rc.eContainmentFeature(), rc);
- assertNotNull(ref);
- }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextScopingTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextScopingTest.java
new file mode 100644
index 0000000..a5784f0
--- /dev/null
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextScopingTest.java
@@ -0,0 +1 @@
+/******************************************************************************* * Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ package org.eclipse.xtext.xtext; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.AbstractRule; import org.eclipse.xtext.Assignment; import org.eclipse.xtext.Grammar; import org.eclipse.xtext.GrammarUtil; import org.eclipse.xtext.Group; import org.eclipse.xtext.ParserRule; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.XtextPackage; import org.eclipse.xtext.XtextStandaloneSetup; import org.eclipse.xtext.junit.AbstractXtextTests; import org.eclipse.xtext.resource.XtextResourceSet; /** * @author Sebastian Zarnekow - Initial contribution and API */ public class XtextScopingTest extends AbstractXtextTests { private Grammar grammar; @Override protected void setUp() throws Exception { super.setUp(); with(XtextStandaloneSetup.class); XtextResourceSet resourceSet = get(XtextResourceSet.class); resourceSet.setClasspathURIContext(getClass().getClassLoader()); Resource resource = resourceSet.getResource( URI.createURI("classpath:/org/eclipse/xtext/grammarinheritance/ConcreteTestLanguage.xtext"), true); grammar = (Grammar) resource.getContents().get(0); } @Override protected void tearDown() throws Exception { grammar = null; super.tearDown(); } public void testSetup() { assertNotNull(grammar); } public void testScope_01() { ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(grammar, "AbstractCallOverridenParserRule"); assertNotNull(rule); Group group = (Group) rule.getAlternatives(); Assignment ass = (Assignment) group.getTokens().get(1); assertNotNull(ass); RuleCall call = (RuleCall) ass.getTerminal(); AbstractRule calledRule = call.getRule(); assertNotNull(calledRule); String text = getLinkingService().getLinkText(calledRule, XtextPackage.Literals.RULE_CALL__RULE, call); assertNotNull(text); assertEquals(calledRule.getName(), text); } } \ No newline at end of file