mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
[xtext][tests] Migrated to JUnit 4.x
This commit is contained in:
parent
9d595ccd1f
commit
c178ebb32b
315 changed files with 3763 additions and 3529 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Xtext Junit4 Support
|
||||
Bundle-SymbolicName: org.eclipse.xtext.junit4
|
||||
Bundle-Version: 2.2.1.qualifier
|
||||
Bundle-Version: 2.3.0.qualifier
|
||||
Bundle-Vendor: Eclipse Modeling Project
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Export-Package: org.eclipse.xtext.junit4,
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Xtext Generator Tests
|
||||
Bundle-Name: Xtext Tests
|
||||
Bundle-SymbolicName: org.eclipse.xtext.tests;singleton:=true
|
||||
Bundle-Version: 2.2.1.qualifier
|
||||
Bundle-Version: 2.3.0.qualifier
|
||||
Bundle-Vendor: Eclipse.org
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Require-Bundle: org.eclipse.xtext;bundle-version="2.0.0",
|
||||
org.eclipse.xtext.generator;bundle-version="2.0.0",
|
||||
org.junit;bundle-version="[3.0.0,4.0.0)",
|
||||
org.easymock;bundle-version="2.3.0",
|
||||
org.eclipse.xtext.junit;bundle-version="2.0.0",
|
||||
org.eclipse.emf.mwe.utils;bundle-version="1.0.0",
|
||||
org.eclipse.xtext.util;bundle-version="2.0.0",
|
||||
org.eclipse.emf.ecore,
|
||||
|
@ -18,9 +16,13 @@ Require-Bundle: org.eclipse.xtext;bundle-version="2.0.0",
|
|||
org.eclipse.xtext.ecore;bundle-version="2.0.0",
|
||||
org.eclipse.emf.mwe2.launch;bundle-version="2.2.0";resolution:=optional,
|
||||
org.eclipse.xtext.testlanguages;bundle-version="2.0.0",
|
||||
org.antlr.runtime
|
||||
org.antlr.runtime,
|
||||
org.eclipse.xtext.junit4;bundle-version="2.3.0"
|
||||
Bundle-ClassPath: lib/simple.jar,.
|
||||
Import-Package: org.apache.log4j
|
||||
Import-Package: org.apache.log4j,
|
||||
org.junit;version="4.5.0",
|
||||
org.junit.runner;version="4.5.0",
|
||||
org.junit.runners;version="4.5.0"
|
||||
Export-Package: org.eclipse.xtext.generator.ecore,
|
||||
org.eclipse.xtext.generator.ecore.services,
|
||||
org.eclipse.xtext.generator.ecore.superPackage,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||
<booleanAttribute key="default" value="true"/>
|
||||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-org.eclipse.xtext.purexbase.tests-workspace"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-org.eclipse.xtext.tests-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/org.eclipse.xtext.tests/src"/>
|
||||
</listAttribute>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.xtext.tests/src"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.xtext.tests"/>
|
||||
|
|
|
@ -15,8 +15,9 @@ import org.eclipse.emf.ecore.EObject;
|
|||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.util.concurrent.IUnitOfWork;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -24,39 +25,39 @@ import org.eclipse.xtext.util.concurrent.IUnitOfWork;
|
|||
public class AllContentsPerformanceTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
}
|
||||
|
||||
private static int LOOPS = 50 /* 000 */;
|
||||
|
||||
public void testDummy() {
|
||||
@Test public void testDummy() {
|
||||
EcorePackage.eINSTANCE.getEAnnotation();
|
||||
XtextPackage.eINSTANCE.getEAnnotations();
|
||||
}
|
||||
|
||||
public void testEcore() {
|
||||
@Test public void testEcore() {
|
||||
doTest(EcorePackage.eINSTANCE);
|
||||
}
|
||||
|
||||
public void testEcoreUoW() throws Exception {
|
||||
@Test public void testEcoreUoW() throws Exception {
|
||||
doTestUoW(EcorePackage.eINSTANCE);
|
||||
}
|
||||
|
||||
public void testXtext() {
|
||||
@Test public void testXtext() {
|
||||
doTest(XtextPackage.eINSTANCE);
|
||||
}
|
||||
|
||||
public void testXtextUoW() throws Exception {
|
||||
@Test public void testXtextUoW() throws Exception {
|
||||
doTestUoW(XtextPackage.eINSTANCE);
|
||||
}
|
||||
|
||||
public void testXtextGrammar() {
|
||||
@Test public void testXtextGrammar() {
|
||||
doTest(getGrammarAccess().getGrammar());
|
||||
}
|
||||
|
||||
public void testXtextGrammarUoW() throws Exception {
|
||||
@Test public void testXtextGrammarUoW() throws Exception {
|
||||
doTestUoW(getGrammarAccess().getGrammar());
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,9 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
|
|||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.util.Strings;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
@ -51,7 +52,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
@Test public void testSimple() throws Exception {
|
||||
ResourceSet rs = new ResourceSetImpl();
|
||||
Resource foo = rs.createResource(URI.createURI("foo.xmi"), ContentHandler.UNSPECIFIED_CONTENT_TYPE);
|
||||
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
|
||||
|
@ -62,7 +63,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertEquals(true, EcoreUtil2.isValidUri(ePackage, URI.createURI("bar.xmi")));
|
||||
}
|
||||
|
||||
public void testEPackageURI() throws Exception {
|
||||
@Test public void testEPackageURI() throws Exception {
|
||||
ResourceSet rs = new ResourceSetImpl();
|
||||
Resource foo = rs.createResource(URI.createURI("foo.xmi"), ContentHandler.UNSPECIFIED_CONTENT_TYPE);
|
||||
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
|
||||
|
@ -71,7 +72,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertEquals(true, EcoreUtil2.isValidUri(ePackage, URI.createURI(EcorePackage.eNS_URI)));
|
||||
}
|
||||
|
||||
public void testClone() throws Exception {
|
||||
@Test public void testClone() throws Exception {
|
||||
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
|
||||
new XMIResourceFactoryImpl());
|
||||
EPackage.Registry.INSTANCE.put(EcorePackage.eINSTANCE.getNsURI(), EcorePackage.eINSTANCE);
|
||||
|
@ -108,7 +109,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(b.getESuperTypes().get(0),a);
|
||||
}
|
||||
|
||||
public void testCommonCompatibleType01() {
|
||||
@Test public void testCommonCompatibleType01() {
|
||||
EClass a = createEClass("a");
|
||||
EClass b = createEClass("b");
|
||||
EClass c = createEClass("c");
|
||||
|
@ -131,7 +132,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(EOBJECT, EcoreUtil2.getCompatibleType(b, c));
|
||||
}
|
||||
|
||||
public void testCommonCompatibleType02() {
|
||||
@Test public void testCommonCompatibleType02() {
|
||||
EClass a = createEClass("a");
|
||||
EClass b = createEClass("b");
|
||||
EClass c = createEClass("c");
|
||||
|
@ -152,7 +153,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(a, EcoreUtil2.getCompatibleType(d, e));
|
||||
}
|
||||
|
||||
public void testGetCompatibleType_01() {
|
||||
@Test public void testGetCompatibleType_01() {
|
||||
EDataType aString = createEDataType("a", String.class);
|
||||
EDataType anotherString = createEDataType("b", String.class);
|
||||
|
||||
|
@ -160,7 +161,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(anotherString, EcoreUtil2.getCompatibleType(anotherString, aString, null));
|
||||
}
|
||||
|
||||
public void testGetCompatibleType_02() {
|
||||
@Test public void testGetCompatibleType_02() {
|
||||
EDataType aString = createEDataType("a", String.class);
|
||||
EDataType anObject = createEDataType("b", Object.class);
|
||||
|
||||
|
@ -168,7 +169,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(anObject, EcoreUtil2.getCompatibleType(anObject, aString, null));
|
||||
}
|
||||
|
||||
public void testGetCompatibleType_03() {
|
||||
@Test public void testGetCompatibleType_03() {
|
||||
EDataType aCharSequence = createEDataType("a", CharSequence.class);
|
||||
EDataType anAppendable = createEDataType("b", Appendable.class);
|
||||
|
||||
|
@ -176,7 +177,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(null, EcoreUtil2.getCompatibleType(anAppendable, aCharSequence, null));
|
||||
}
|
||||
|
||||
public void testGetCompatibleType_04() {
|
||||
@Test public void testGetCompatibleType_04() {
|
||||
EDataType aString = createEDataType("a", String.class);
|
||||
EDataType anotherString = createEDataType("b", String.class);
|
||||
|
||||
|
@ -184,7 +185,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(anotherString, EcoreUtil2.getCompatibleType(anotherString, aString));
|
||||
}
|
||||
|
||||
public void testGetCompatibleType_05() {
|
||||
@Test public void testGetCompatibleType_05() {
|
||||
EDataType aString = createEDataType("a", String.class);
|
||||
EDataType anObject = createEDataType("b", Object.class);
|
||||
|
||||
|
@ -192,7 +193,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(anObject, EcoreUtil2.getCompatibleType(anObject, aString));
|
||||
}
|
||||
|
||||
public void testGetCompatibleType_06() {
|
||||
@Test public void testGetCompatibleType_06() {
|
||||
EDataType aCharSequence = createEDataType("a", CharSequence.class);
|
||||
EDataType anAppendable = createEDataType("b", Appendable.class);
|
||||
|
||||
|
@ -200,7 +201,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertSame(null, EcoreUtil2.getCompatibleType(anAppendable, aCharSequence));
|
||||
}
|
||||
|
||||
public void testGetAllSuperTypesWithCycle() {
|
||||
@Test public void testGetAllSuperTypesWithCycle() {
|
||||
EClass a = createEClass("a");
|
||||
EClass b = createEClass("b");
|
||||
b.getESuperTypes().add(a);
|
||||
|
@ -215,7 +216,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
assertTrue(EcoreUtil2.getAllSuperTypes(b).contains(b));
|
||||
}
|
||||
|
||||
public void testGetAllReferencedObjects() {
|
||||
@Test public void testGetAllReferencedObjects() {
|
||||
EClass a = createEClass("a");
|
||||
EClass b = createEClass("b");
|
||||
|
||||
|
@ -240,7 +241,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
objA.eSet(ref, objB);
|
||||
}
|
||||
|
||||
public void testExternalFormOfEReference() throws Exception {
|
||||
@Test public void testExternalFormOfEReference() throws Exception {
|
||||
Registry registry = EPackage.Registry.INSTANCE;
|
||||
Set<String> uris = Sets.newHashSet(registry.keySet());
|
||||
for (String string : uris) {
|
||||
|
@ -260,7 +261,7 @@ public class EcoreUtil2Test extends AbstractXtextTests {
|
|||
/**
|
||||
* This test assumes that an EPackage with indexed references is no longer available.
|
||||
*/
|
||||
public void testExternalFormOfEReferenceNoNPE() throws Exception {
|
||||
@Test public void testExternalFormOfEReferenceNoNPE() throws Exception {
|
||||
EReference reference = EcorePackage.Literals.EATTRIBUTE__EATTRIBUTE_TYPE;
|
||||
URI uri = EcoreUtil.getURI(reference);
|
||||
String externalForm = uri.toString();
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
package org.eclipse.xtext;
|
||||
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -16,12 +17,12 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testGetReference_01() throws Exception {
|
||||
@Test public void testGetReference_01() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: model=[Model];";
|
||||
|
@ -33,7 +34,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("Model", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_02() throws Exception {
|
||||
@Test public void testGetReference_02() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: {SubModel} model=[Model];";
|
||||
|
@ -47,7 +48,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("SubModel", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_03() throws Exception {
|
||||
@Test public void testGetReference_03() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: {SubModel1} model=[Model] | {SubModel2} model=[Model];";
|
||||
|
@ -62,7 +63,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("Model", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_04() throws Exception {
|
||||
@Test public void testGetReference_04() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: {SubModel1} model=[Model] | {SubModel2} model=[Model];";
|
||||
|
@ -77,7 +78,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("Model", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_05() throws Exception {
|
||||
@Test public void testGetReference_05() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: {SubModel1} model1=[Model] | {SubModel2} model2=[Model];";
|
||||
|
@ -92,7 +93,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("SubModel1", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_06() throws Exception {
|
||||
@Test public void testGetReference_06() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: {SubModel1} model1=[Model] | {SubModel2} model2=[Model];";
|
||||
|
@ -107,7 +108,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("SubModel2", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_07() throws Exception {
|
||||
@Test public void testGetReference_07() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: model1=[Model] & model2=[Model|STRING];";
|
||||
|
@ -121,7 +122,7 @@ public class GrammarUtilGetReferenceTest extends AbstractXtextTests {
|
|||
assertEquals("Model", reference.getEContainingClass().getName());
|
||||
}
|
||||
|
||||
public void testGetReference_08() throws Exception {
|
||||
@Test public void testGetReference_08() throws Exception {
|
||||
String grammarAsString = "grammar foo.bar with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Model: {SubModel} (model1=[Model] & model2=[Model|STRING]);";
|
||||
|
|
|
@ -12,10 +12,12 @@ import java.util.List;
|
|||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.linking.langATestLanguage.Main;
|
||||
import org.eclipse.xtext.linking.services.LangATestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Heiko Behrens - Initial contribution and API
|
||||
|
@ -23,7 +25,7 @@ import org.eclipse.xtext.resource.XtextResource;
|
|||
*/
|
||||
public class GrammarUtilTest extends AbstractXtextTests {
|
||||
|
||||
public void testAllMetamodelDeclarations_01() throws Exception {
|
||||
@Test public void testAllMetamodelDeclarations_01() throws Exception {
|
||||
with(XtextStandaloneSetup.class);
|
||||
String model = "grammar foo with org.eclipse.xtext.common.Terminals " +
|
||||
"import 'http://www.eclipse.org/emf/2002/Ecore' as ecore " +
|
||||
|
@ -48,7 +50,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
assertEquals("http://3", decl.getEPackage().getNsURI());
|
||||
}
|
||||
|
||||
public void testAllMetamodelDeclarations_02() throws Exception {
|
||||
@Test public void testAllMetamodelDeclarations_02() throws Exception {
|
||||
with(XtextStandaloneSetup.class);
|
||||
String model = "grammar foo with org.eclipse.xtext.common.Terminals " +
|
||||
"import 'http://www.eclipse.org/emf/2002/Ecore' as bar " +
|
||||
|
@ -80,7 +82,7 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
assertSame(decls.get(1), abstractRule.getType().getMetamodel());
|
||||
}
|
||||
|
||||
public void testAllMetamodelDeclarations_03() throws Exception {
|
||||
@Test public void testAllMetamodelDeclarations_03() throws Exception {
|
||||
with(XtextStandaloneSetup.class);
|
||||
String model = "grammar foo with org.eclipse.xtext.common.Terminals " +
|
||||
"generate g 'http://3' as bar " +
|
||||
|
@ -113,14 +115,14 @@ public class GrammarUtilTest extends AbstractXtextTests {
|
|||
assertSame(decls.get(0), abstractRule.getType().getMetamodel());
|
||||
}
|
||||
|
||||
public void testGetReference() throws Exception {
|
||||
@Test public void testGetReference() throws Exception {
|
||||
with(LangATestLanguageStandaloneSetup.class);
|
||||
XtextResource resource = getResourceFromStringAndExpect("type A extends B", 1);
|
||||
|
||||
Assignment asExtends = get(LangATestLanguageGrammarAccess.class).getTypeAccess().getExtendsAssignment_2_1();
|
||||
CrossReference xref = (CrossReference) asExtends.getTerminal();
|
||||
EObject model = getModel(resource);
|
||||
EObject typeA = (EObject) invokeWithXtend("types.first()", model);
|
||||
Main model = (Main) getModel(resource);
|
||||
EObject typeA = model.getTypes().get(0);
|
||||
EReference ref = GrammarUtil.getReference(xref, typeA.eClass());
|
||||
assertNotNull(ref);
|
||||
assertEquals("extends", ref.getName());
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
package org.eclipse.xtext;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
import org.eclipse.xtext.xtextTest.Assignment;
|
||||
import org.eclipse.xtext.xtextTest.Grammar;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -19,15 +21,15 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public class XtextGrammarTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextGrammarTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testInstantiate() throws Exception {
|
||||
EObject grammar = getModelAndExpect("grammar foo generate foo 'bar' Foo : name=ID;", 2);
|
||||
assertWithXtend("'Foo'","rules.first().name",grammar);
|
||||
assertWithXtend("'name'","rules.first().alternatives.feature",grammar);
|
||||
@Test public void testInstantiate() throws Exception {
|
||||
Grammar grammar = (Grammar) getModelAndExpect("grammar foo generate foo 'bar' Foo : name=ID;", 2);
|
||||
assertEquals("Foo", grammar.getRules().get(0).getName());
|
||||
assertEquals("name", ((Assignment) grammar.getRules().get(0).getAlternatives()).getFeature());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.actions;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
|
@ -19,6 +19,7 @@ import org.eclipse.xtext.testlanguages.actionLang.ActionLangPackage;
|
|||
import org.eclipse.xtext.testlanguages.actionLang.Model;
|
||||
import org.eclipse.xtext.testlanguages.actionLang.Parent;
|
||||
import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
|
@ -31,7 +32,7 @@ public class AntlrParserTest extends AbstractXtextTests {
|
|||
private ParserTestHelper helper;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(ActionTestLanguageStandaloneSetup.class);
|
||||
grammarAccess = get(ActionTestLanguageGrammarAccess.class);
|
||||
|
@ -39,7 +40,7 @@ public class AntlrParserTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
grammarAccess = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
@ -55,7 +56,7 @@ public class AntlrParserTest extends AbstractXtextTests {
|
|||
* LeafNode (GrammarElement: RuleCall[ID], Element: null)
|
||||
* </pre>
|
||||
*/
|
||||
public void testParseWithoutActionCall() throws Exception {
|
||||
@Test public void testParseWithoutActionCall() throws Exception {
|
||||
XtextResource resource = helper.getResourceFromString("myID");
|
||||
assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -91,7 +92,7 @@ public class AntlrParserTest extends AbstractXtextTests {
|
|||
* LeafNode (GrammarElement: RuleCall[ID], Element: null)
|
||||
* </pre>
|
||||
*/
|
||||
public void testParseWithActionCall() throws Exception {
|
||||
@Test public void testParseWithActionCall() throws Exception {
|
||||
XtextResource resource = helper.getResourceFromString("myID otherID");
|
||||
assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
|
|
@ -8,18 +8,18 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.common.services;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.conversion.IValueConverter;
|
||||
import org.eclipse.xtext.conversion.ValueConverterException;
|
||||
import org.eclipse.xtext.conversion.impl.INTValueConverter;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
public class DefaultTerminalConverterTest extends TestCase {
|
||||
public class DefaultTerminalConverterTest extends Assert {
|
||||
|
||||
public void testINT() throws Exception {
|
||||
@Test public void testINT() throws Exception {
|
||||
IValueConverter<Integer> valueConverter = new INTValueConverter();
|
||||
try {
|
||||
valueConverter.toValue("", null);
|
||||
|
|
|
@ -14,20 +14,20 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces;
|
||||
import org.eclipse.xtext.util.concurrent.IUnitOfWork;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*
|
||||
*/
|
||||
public class ReadWriteAccessTest extends TestCase {
|
||||
public class ReadWriteAccessTest extends Assert {
|
||||
|
||||
public static class Foo {
|
||||
public String val = "foo";
|
||||
}
|
||||
|
||||
public void testModifyAndRead() throws Exception {
|
||||
@Test public void testModifyAndRead() throws Exception {
|
||||
final Foo foo = new Foo();
|
||||
final AbstractReadWriteAcces<Foo> access = new AbstractReadWriteAcces<Foo>() {
|
||||
@Override
|
||||
|
|
|
@ -12,8 +12,9 @@ import org.eclipse.xtext.conversion.IValueConverter;
|
|||
import org.eclipse.xtext.conversion.IValueConverterService;
|
||||
import org.eclipse.xtext.conversion.ValueConverter;
|
||||
import org.eclipse.xtext.conversion.ValueConverterException;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -87,7 +88,7 @@ public class DeclarativeValueConverterServiceTest extends AbstractXtextTests {
|
|||
private String expectedIdent = null;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new XtextStandaloneSetup() {
|
||||
@Override
|
||||
|
@ -111,19 +112,19 @@ public class DeclarativeValueConverterServiceTest extends AbstractXtextTests {
|
|||
assertEquals(expectedIdent, ident);
|
||||
}
|
||||
|
||||
public void testSimpleIdConverter() {
|
||||
@Test public void testSimpleIdConverter() {
|
||||
IValueConverterService converter = get(SimpleIdConverter.class);
|
||||
expectedIdent = "idConverter";
|
||||
converter.toValue("Foo", "ID", null);
|
||||
}
|
||||
|
||||
public void testOverriddenIdConverter() {
|
||||
@Test public void testOverriddenIdConverter() {
|
||||
IValueConverterService converter = get(OverriddenIdConverter.class);
|
||||
expectedIdent = "overriddenIdConverter";
|
||||
converter.toString("Foo", "ID");
|
||||
}
|
||||
|
||||
public void testDuplicateConverters() {
|
||||
@Test public void testDuplicateConverters() {
|
||||
IValueConverterService converter = get(DuplicateConverters.class);
|
||||
try {
|
||||
converter.toString("Foo", "unknown");
|
||||
|
|
|
@ -13,7 +13,8 @@ package org.eclipse.xtext.documentation.impl;
|
|||
import org.eclipse.xtext.dummy.DummyTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.dummy.dummyLang.Element;
|
||||
import org.eclipse.xtext.dummy.dummyLang.Model;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Christoph Kulla - Initial contribution and API
|
||||
|
@ -25,7 +26,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
final String document = "element A;";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(DummyTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
@ -47,7 +48,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
return mlcdp.getDocumentation(element);
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
@Test public void testSimple() throws Exception {
|
||||
String documentation = getComment (
|
||||
"/**\n" +
|
||||
"* " + expectedDocumentation + "\n" +
|
||||
|
@ -56,7 +57,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testMissingStartTag() throws Exception {
|
||||
@Test public void testMissingStartTag() throws Exception {
|
||||
String documentation = getComment (
|
||||
"/*\n" +
|
||||
"* " + expectedDocumentation + "\n" +
|
||||
|
@ -65,7 +66,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testRect() throws Exception {
|
||||
@Test public void testRect() throws Exception {
|
||||
String documentation = getComment (
|
||||
"/********************************************\n" +
|
||||
" ** **\n" +
|
||||
|
@ -76,7 +77,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testWhitespace() throws Exception {
|
||||
@Test public void testWhitespace() throws Exception {
|
||||
String documentation = getComment (
|
||||
" \t \t /***\n" +
|
||||
"** " + expectedDocumentation + " \t \t ** \t \t \n" +
|
||||
|
@ -85,7 +86,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testWithSingleLineComment() throws Exception {
|
||||
@Test public void testWithSingleLineComment() throws Exception {
|
||||
String documentation = getComment (
|
||||
"/**\n" +
|
||||
"* " + expectedDocumentation + "\n" +
|
||||
|
@ -95,7 +96,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testMultipleCommentsForOneObject() throws Exception {
|
||||
@Test public void testMultipleCommentsForOneObject() throws Exception {
|
||||
String documentation = getComment (
|
||||
"/**\n" +
|
||||
"* " + expectedDocumentation + "2\n" +
|
||||
|
@ -107,7 +108,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testMultipleComments() throws Exception {
|
||||
@Test public void testMultipleComments() throws Exception {
|
||||
String s = "/**\n" +
|
||||
"* " + expectedDocumentation + "\n" +
|
||||
"*/\n" +
|
||||
|
@ -117,7 +118,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals (expectedDocumentation, documentation);
|
||||
}
|
||||
|
||||
public void testMultipleMultiLineComments() throws Exception {
|
||||
@Test public void testMultipleMultiLineComments() throws Exception {
|
||||
String documentation = getComment ("/**\n" +
|
||||
"* " + expectedDocumentation + "\n" +
|
||||
"*/\n" +
|
||||
|
@ -126,7 +127,7 @@ public class MultiLineCommentDocumentationProviderTest extends AbstractXtextTest
|
|||
assertEquals ("", documentation);
|
||||
}
|
||||
|
||||
public void testNoComment() throws Exception {
|
||||
@Test public void testNoComment() throws Exception {
|
||||
String documentation = getComment (document);
|
||||
assertNull (documentation);
|
||||
}
|
||||
|
|
|
@ -9,14 +9,13 @@ package org.eclipse.xtext.ecore;
|
|||
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.eclipse.xtext.resource.impl.ResourceServiceProviderRegistryImpl;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
public class EcoreSupportTest extends TestCase {
|
||||
public class EcoreSupportTest extends Assert {
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -33,7 +32,7 @@ public class EcoreSupportTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
@Test public void testSimple() throws Exception {
|
||||
final ResourceServiceProviderRegistryImpl registry = new ResourceServiceProviderRegistryImpl();
|
||||
EcoreSupport support = new EcoreSupport();
|
||||
support.setGuiceModule(new EcoreRuntimeModuleForTest(registry));
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.eclipse.xtext.enumrules;
|
|||
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.xtext.enumrules.enums.EnumsPackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -17,7 +17,7 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public abstract class AbstractEnumRulesTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
EnumsPackage pack = EnumsPackage.eINSTANCE;
|
||||
EPackage.Registry.INSTANCE.put(pack.getNsURI(), pack);
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
package org.eclipse.xtext.enumrules;
|
||||
|
||||
import org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.parser.ParserTestHelper;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
|
@ -20,19 +21,19 @@ public class EnumAndReferenceTest extends AbstractXtextTests {
|
|||
private ParserTestHelper helper;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(EnumAndReferenceTestLanguageStandaloneSetup.class);
|
||||
helper = new ParserTestHelper(getResourceFactory(), getParser(), get(Keys.RESOURCE_SET_KEY),getCurrentFileExtension());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
helper = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testSemantic() throws Exception {
|
||||
@Test public void testSemantic() throws Exception {
|
||||
String modelAsString = "kindOfKeyword Hoo reference Hoo";
|
||||
EntityWithEnumAndReference model = (EntityWithEnumAndReference) helper.getModel(modelAsString);
|
||||
assertNotNull(model);
|
||||
|
@ -41,7 +42,7 @@ public class EnumAndReferenceTest extends AbstractXtextTests {
|
|||
assertEquals(model, model.getRef());
|
||||
}
|
||||
|
||||
public void testNodes() throws Exception {
|
||||
@Test public void testNodes() throws Exception {
|
||||
String modelAsString = "kindOfKeyword Hoo reference Hoo";
|
||||
EntityWithEnumAndReference model = (EntityWithEnumAndReference) helper.getModel(modelAsString);
|
||||
ICompositeNode node = NodeModelUtils.getNode(model);
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.xtext.Grammar;
|
|||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.enumrules.enums.ExistingEnum;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.TransformationDiagnostic;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -26,7 +27,7 @@ import org.eclipse.xtext.xtext.ecoreInference.TransformationDiagnostic;
|
|||
public class GrammarParserTest extends AbstractEnumRulesTest {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
}
|
||||
|
@ -38,7 +39,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
}
|
||||
}
|
||||
|
||||
public void testEnum_01() throws Exception {
|
||||
@Test public void testEnum_01() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/AbstractEnumRulesTest/TestEnum/1'\n" +
|
||||
|
@ -58,7 +59,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("Value1", value.getLiteral());
|
||||
}
|
||||
|
||||
public void testEnum_02() throws Exception {
|
||||
@Test public void testEnum_02() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/AbstractEnumRulesTest/TestEnum/2'\n" +
|
||||
|
@ -78,7 +79,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("Value1", value.getLiteral());
|
||||
}
|
||||
|
||||
public void testEnum_03() throws Exception {
|
||||
@Test public void testEnum_03() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/AbstractEnumRulesTest/TestEnum/3'\n" +
|
||||
|
@ -98,7 +99,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("value", value.getLiteral());
|
||||
}
|
||||
|
||||
public void testEnum_04() throws Exception {
|
||||
@Test public void testEnum_04() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore'\n" +
|
||||
|
@ -126,7 +127,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals(value.getLiteral(), decl.getLiteral().getValue());
|
||||
}
|
||||
|
||||
public void testEnum_05() throws Exception {
|
||||
@Test public void testEnum_05() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore'\n" +
|
||||
|
@ -154,7 +155,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("value", decl.getLiteral().getValue());
|
||||
}
|
||||
|
||||
public void testEnum_06() throws Exception {
|
||||
@Test public void testEnum_06() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/AbstractEnumRulesTest/TestEnum/6'\n" +
|
||||
|
@ -184,7 +185,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("Value3", value.getLiteral());
|
||||
}
|
||||
|
||||
public void testEnum_07() throws Exception {
|
||||
@Test public void testEnum_07() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/AbstractEnumRulesTest/TestEnum/7'\n" +
|
||||
|
@ -204,7 +205,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("Value", value.getLiteral());
|
||||
}
|
||||
|
||||
public void testEnum_08() throws Exception {
|
||||
@Test public void testEnum_08() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/AbstractEnumRulesTest/TestEnum/8'\n" +
|
||||
|
@ -224,7 +225,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("Value", value.getLiteral());
|
||||
}
|
||||
|
||||
public void testEnum_09() throws Exception {
|
||||
@Test public void testEnum_09() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.common.Terminals\n" +
|
||||
"import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore'\n" +
|
||||
|
@ -238,7 +239,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals(modelAsString.lastIndexOf("Absent"), offset);
|
||||
}
|
||||
|
||||
public void testEnum_10() throws Exception {
|
||||
@Test public void testEnum_10() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.enumrules.EnumRulesTestLanguage\n" +
|
||||
"import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore'\n" +
|
||||
|
@ -266,7 +267,7 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals("SameName", decl.getLiteral().getValue());
|
||||
}
|
||||
|
||||
public void testEnum_11() throws Exception {
|
||||
@Test public void testEnum_11() throws Exception {
|
||||
String modelAsString =
|
||||
"grammar TestLanguage with org.eclipse.xtext.enumrules.EnumRulesTestLanguage\n" +
|
||||
"import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore' as existing\n" +
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.eclipse.xtext.enumrules.enumRulesTestLanguage.Model;
|
|||
import org.eclipse.xtext.enumrules.enums.EnumsPackage;
|
||||
import org.eclipse.xtext.enumrules.enums.ExistingEnum;
|
||||
import org.eclipse.xtext.parser.ParserTestHelper;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -22,19 +23,19 @@ public class ParserTest extends AbstractEnumRulesTest {
|
|||
private ParserTestHelper helper;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(EnumRulesTestLanguageStandaloneSetup.class);
|
||||
helper = new ParserTestHelper(getResourceFactory(), getParser(), get(Keys.RESOURCE_SET_KEY),getCurrentFileExtension());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
helper = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testParseSameName() throws Exception {
|
||||
@Test public void testParseSameName() throws Exception {
|
||||
String modelAsString = "existing SameName";
|
||||
Model model = (Model) helper.getModel(modelAsString);
|
||||
assertNotNull(model);
|
||||
|
@ -42,7 +43,7 @@ public class ParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals(EnumRulesTestLanguagePackage.Literals.GENERATED_ENUM.getDefaultValue(), model.getGenerated());
|
||||
}
|
||||
|
||||
public void testParseSameName2() throws Exception {
|
||||
@Test public void testParseSameName2() throws Exception {
|
||||
String modelAsString = "generated SameName";
|
||||
Model model = (Model) helper.getModel(modelAsString);
|
||||
assertNotNull(model);
|
||||
|
@ -50,7 +51,7 @@ public class ParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals(EnumsPackage.Literals.EXISTING_ENUM.getDefaultValue(), model.getExisting());
|
||||
}
|
||||
|
||||
public void testParseOverridden() throws Exception {
|
||||
@Test public void testParseOverridden() throws Exception {
|
||||
String modelAsString = "existing overridden";
|
||||
Model model = (Model) helper.getModel(modelAsString);
|
||||
assertNotNull(model);
|
||||
|
@ -58,7 +59,7 @@ public class ParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals(EnumRulesTestLanguagePackage.Literals.GENERATED_ENUM.getDefaultValue(), model.getGenerated());
|
||||
}
|
||||
|
||||
public void testParseDifferentName() throws Exception {
|
||||
@Test public void testParseDifferentName() throws Exception {
|
||||
String modelAsString = "existing DifferentLiteral";
|
||||
Model model = (Model) helper.getModel(modelAsString);
|
||||
assertNotNull(model);
|
||||
|
@ -66,7 +67,7 @@ public class ParserTest extends AbstractEnumRulesTest {
|
|||
assertEquals(EnumRulesTestLanguagePackage.Literals.GENERATED_ENUM.getDefaultValue(), model.getGenerated());
|
||||
}
|
||||
|
||||
public void testParseDifferentName2() throws Exception {
|
||||
@Test public void testParseDifferentName2() throws Exception {
|
||||
String modelAsString = "generated DifferentLiteral";
|
||||
Model model = (Model) helper.getModel(modelAsString);
|
||||
assertNotNull(model);
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.eclipse.xtext.enumrules.enumRulesTestLanguage.Model;
|
|||
import org.eclipse.xtext.enumrules.enums.ExistingEnum;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -24,7 +25,7 @@ public class SerializationTest extends AbstractEnumRulesTest {
|
|||
private Model model;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(EnumRulesTestLanguageStandaloneSetup.class);
|
||||
resourceSet = get(XtextResourceSet.class);
|
||||
|
@ -35,7 +36,7 @@ public class SerializationTest extends AbstractEnumRulesTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
model = null;
|
||||
resource = null;
|
||||
resourceSet = null;
|
||||
|
@ -53,7 +54,7 @@ public class SerializationTest extends AbstractEnumRulesTest {
|
|||
assertEquals("generated SameName", result);
|
||||
}
|
||||
|
||||
public void testSerialize_02() throws Exception {
|
||||
@Test public void testSerialize_02() throws Exception {
|
||||
model.setExisting(ExistingEnum.DIFFERENT_NAME);
|
||||
String result = serialize(model);
|
||||
assertEquals("existing DifferentLiteral", result);
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.eclipse.xtext.generator;
|
|||
|
||||
//import org.eclipse.xtext.generator.generatorTestLanguage.GeneratorTestLanguagePackage;
|
||||
//import org.eclipse.xtext.generator.generatorTestLanguage.Rule;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -17,17 +17,17 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public abstract class AbstractLargeMetamodelTest extends AbstractXtextTests {
|
||||
|
||||
// @Override
|
||||
// protected void setUp() throws Exception {
|
||||
// public void setUp() throws Exception {
|
||||
// super.setUp();
|
||||
// with(GeneratorTestLanguageStandaloneSetup.class);
|
||||
// }
|
||||
//
|
||||
// public void testRuleClass() {
|
||||
// @Test public void testRuleClass() {
|
||||
// Class<Rule> ruleClass = Rule.class;
|
||||
// assertNotNull(ruleClass);
|
||||
// }
|
||||
//
|
||||
// public void testEPackage() {
|
||||
// @Test public void testEPackage() {
|
||||
// GeneratorTestLanguagePackage instance = GeneratorTestLanguagePackage.eINSTANCE;
|
||||
// assertNotNull(instance);
|
||||
// }
|
||||
|
|
|
@ -9,16 +9,16 @@ package org.eclipse.xtext.generator;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
public class CompositeGeneratorFragmentTest extends TestCase {
|
||||
public class CompositeGeneratorFragmentTest extends Assert {
|
||||
|
||||
public void testFinalBindingsPersist() throws Exception {
|
||||
@Test public void testFinalBindingsPersist() throws Exception {
|
||||
CompositeGeneratorFragment fragment = new CompositeGeneratorFragment();
|
||||
fragment.addFragment(new DefaultGeneratorFragment() {
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public class CompositeGeneratorFragmentTest extends TestCase {
|
|||
assertEquals("BAR", bindings.iterator().next().getValue().getTypeName());
|
||||
}
|
||||
|
||||
public void testNonFinalBindingsOverride() throws Exception {
|
||||
@Test public void testNonFinalBindingsOverride() throws Exception {
|
||||
CompositeGeneratorFragment fragment = new CompositeGeneratorFragment();
|
||||
fragment.addFragment(new DefaultGeneratorFragment() {
|
||||
@Override
|
||||
|
@ -72,7 +72,7 @@ public class CompositeGeneratorFragmentTest extends TestCase {
|
|||
assertEquals("FOO", bindings.iterator().next().getValue().getTypeName());
|
||||
}
|
||||
|
||||
public void testFinalBindingsConflict() throws Exception {
|
||||
@Test public void testFinalBindingsConflict() throws Exception {
|
||||
CompositeGeneratorFragment fragment = new CompositeGeneratorFragment();
|
||||
fragment.addFragment(new DefaultGeneratorFragment() {
|
||||
@Override
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.generator;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.generator.serializer.JavaFile;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
public class JavaFileTest extends TestCase {
|
||||
public class JavaFileTest extends Assert {
|
||||
|
||||
public void testMain() {
|
||||
@Test public void testMain() {
|
||||
JavaFile file = new JavaFile("foo");
|
||||
assertEquals("Foo", file.imported("foo.Foo"));
|
||||
assertEquals("bar.Foo", file.imported("bar.Foo"));
|
||||
|
|
|
@ -11,14 +11,15 @@ import java.io.File;
|
|||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
*/
|
||||
public class JavaIoFileSystemAccessTest extends TestCase {
|
||||
public class JavaIoFileSystemAccessTest extends Assert {
|
||||
|
||||
public void testDirsAreCreated() throws Exception {
|
||||
@Test public void testDirsAreCreated() throws Exception {
|
||||
String tempDir = System.getProperties().getProperty("java.io.tmpdir") + File.separator;
|
||||
File tmpDir = new File(tempDir);
|
||||
JavaIoFileSystemAccess fileSystemAccess = new JavaIoFileSystemAccess();
|
||||
|
@ -34,7 +35,7 @@ public class JavaIoFileSystemAccessTest extends TestCase {
|
|||
dir.delete();
|
||||
}
|
||||
|
||||
public void testURI() throws Exception {
|
||||
@Test public void testURI() throws Exception {
|
||||
JavaIoFileSystemAccess fileSystemAccess = new JavaIoFileSystemAccess();
|
||||
fileSystemAccess.setOutputPath("testOutput", "/testDir");
|
||||
URI uri = fileSystemAccess.getURI("testFile", "testOutput");
|
||||
|
|
|
@ -16,19 +16,19 @@ import java.util.LinkedHashSet;
|
|||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.util.MergeableManifest;
|
||||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.eclipse.xtext.util.Wrapper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*
|
||||
*/
|
||||
public class ManifestMergerTest extends TestCase {
|
||||
public class ManifestMergerTest extends Assert {
|
||||
|
||||
public void testMergeRequiredBundles() throws Exception {
|
||||
@Test public void testMergeRequiredBundles() throws Exception {
|
||||
String packageName = getClass().getPackage().getName().replace('.', '/');
|
||||
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
|
||||
MergeableManifest manifest = new MergeableManifest(resourceAsStream);
|
||||
|
@ -39,7 +39,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
assertEquals(before + ",foo.bar.baz", after.replaceAll("\\s",""));
|
||||
}
|
||||
|
||||
public void testMergeExportedPackages() throws Exception {
|
||||
@Test public void testMergeExportedPackages() throws Exception {
|
||||
String packageName = getClass().getPackage().getName().replace('.', '/');
|
||||
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
|
||||
MergeableManifest manifest = new MergeableManifest(resourceAsStream);
|
||||
|
@ -55,7 +55,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
assertFalse(manifest.isModified());
|
||||
}
|
||||
|
||||
public void testNoLongLine() throws Exception {
|
||||
@Test public void testNoLongLine() throws Exception {
|
||||
String packageName = getClass().getPackage().getName().replace('.', '/');
|
||||
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
|
||||
MergeableManifest manifest = new MergeableManifest(resourceAsStream);
|
||||
|
@ -73,7 +73,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
assertEquals(result, ' ', result.charAt(idx + 2));
|
||||
}
|
||||
|
||||
public void testSplit512Length() throws Exception {
|
||||
@Test public void testSplit512Length() throws Exception {
|
||||
String packageName = getClass().getPackage().getName().replace('.', '/');
|
||||
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
|
||||
MergeableManifest manifest = new MergeableManifest(resourceAsStream);
|
||||
|
@ -91,7 +91,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testNoChanges() throws Exception {
|
||||
@Test public void testNoChanges() throws Exception {
|
||||
String packageName = getClass().getPackage().getName().replace('.', '/');
|
||||
InputStream resourceAsStream = getClass().getResourceAsStream("/" + packageName + "/Test_Manifest.MF");
|
||||
MergeableManifest manifest = new MergeableManifest(resourceAsStream);
|
||||
|
@ -102,7 +102,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
assertEquals(before + ",foo.bar.baz", after.replaceAll("\\s",""));
|
||||
}
|
||||
|
||||
public void testMergeIntoCommaSeparatedList() throws Exception {
|
||||
@Test public void testMergeIntoCommaSeparatedList() throws Exception {
|
||||
LinkedHashSet<String> toMerge = new LinkedHashSet<String>();
|
||||
toMerge.add("foo");
|
||||
toMerge.add("bar");
|
||||
|
@ -123,7 +123,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
return s==null?null:s.replaceAll("\\s", "");
|
||||
}
|
||||
|
||||
public void testMergeIntoCommaSeparatedListWithParams() throws Exception {
|
||||
@Test public void testMergeIntoCommaSeparatedListWithParams() throws Exception {
|
||||
LinkedHashSet<String> toMerge = new LinkedHashSet<String>();
|
||||
toMerge.add("foo");
|
||||
toMerge.add("bar");
|
||||
|
@ -135,7 +135,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
"bar;special=foo , x", toMerge, Wrapper.wrap(false))));
|
||||
}
|
||||
|
||||
public void testMergeIntoCommaSeparatedListWithCommaSeparatedParams() throws Exception {
|
||||
@Test public void testMergeIntoCommaSeparatedListWithCommaSeparatedParams() throws Exception {
|
||||
LinkedHashSet<String> toMerge = new LinkedHashSet<String>();
|
||||
toMerge.add("foo");
|
||||
toMerge.add("bar");
|
||||
|
@ -145,7 +145,7 @@ public class ManifestMergerTest extends TestCase {
|
|||
"bar;x-friends=\"xxx,foo,bar,zzz\"", toMerge, Wrapper.wrap(false))));
|
||||
}
|
||||
|
||||
public void testMergeIntoCommaSeparatedListInvalidParam() throws Exception {
|
||||
@Test public void testMergeIntoCommaSeparatedListInvalidParam() throws Exception {
|
||||
LinkedHashSet<String> toMerge = new LinkedHashSet<String>();
|
||||
toMerge.add("foo;foo=version");
|
||||
toMerge.add("bar");
|
||||
|
|
|
@ -43,17 +43,17 @@ public class GenModelAccessTestGenerator extends AbstractWorkflowComponent2 {
|
|||
print.println();
|
||||
print.println("import org.eclipse.xtext.generator.ecore.genmodelaccess.nestedPackage1.NestedPackage1Package;");
|
||||
print.println("import org.eclipse.xtext.generator.ecore.genmodelaccess.noLiterals.NoLiteralsPackage;");
|
||||
print.println("import junit.framework.TestCase;");
|
||||
print.println("import junit.framework.Assert;");
|
||||
print.println("import org.junit.Assert;");
|
||||
print.println("import org.junit.Test;");
|
||||
print.println();
|
||||
print.println("public abstract class AccessTest extends TestCase {");
|
||||
print.println("public abstract class AccessTest extends Assert {");
|
||||
|
||||
EClass rootClass = (EClass) root.getEClassifier("RootClass");
|
||||
EReference rootRef = (EReference) rootClass.getEStructuralFeature("reference1");
|
||||
EAttribute rootAttr = (EAttribute) rootClass.getEStructuralFeature("attribute1");
|
||||
EDataType rootDataType = (EDataType) root.getEClassifier("RootDataType");
|
||||
EEnum rootEnum = (EEnum) root.getEClassifier("RootEnum");
|
||||
print.println(" public void testRootPackage() {");
|
||||
print.println(" @Test public void testRootPackage() {");
|
||||
print.println(" Assert.assertNotNull(" + GenModelAccess.getGenTypeLiteral(root, rs) + ");");
|
||||
print.println(" Assert.assertNotNull(" + GenModelAccess.getGenTypeLiteral(rootClass, rs) + ");");
|
||||
print.println(" Assert.assertNotNull(" + GenModelAccess.getGenTypeLiteral(rootDataType, rs) + ");");
|
||||
|
@ -69,7 +69,7 @@ public class GenModelAccessTestGenerator extends AbstractWorkflowComponent2 {
|
|||
|
||||
EPackage nested = root.getESubpackages().get(0);
|
||||
EClass nestedClass = (EClass) nested.getEClassifier("NestedClass1");
|
||||
print.println(" public void testNestedPackage() {");
|
||||
print.println(" @Test public void testNestedPackage() {");
|
||||
print.println(" Assert.assertNotNull(" + GenModelAccess.getGenTypeLiteral(nested, rs) + ");");
|
||||
print.println(" Assert.assertNotNull(" + GenModelAccess.getGenTypeLiteral(nestedClass, rs) + ");");
|
||||
print.println(" Assert.assertEquals(0," + GenModelAccess.getGenIntLiteral(nestedClass, rs) + ");");
|
||||
|
@ -81,7 +81,7 @@ public class GenModelAccessTestGenerator extends AbstractWorkflowComponent2 {
|
|||
EReference noLitRef = (EReference) noLitClass.getEStructuralFeature("reference2");
|
||||
EAttribute noLitAttr = (EAttribute) noLitClass.getEStructuralFeature("attribute2");
|
||||
EDataType noLitEnum = (EDataType) noLit.getEClassifier("NoLitEnum");
|
||||
print.println(" public void testNoLiteralPackage() {");
|
||||
print.println(" @Test public void testNoLiteralPackage() {");
|
||||
print.println(" Assert.assertNotNull(" + GenModelAccess.getGenTypeLiteral(noLit, rs) + ");");
|
||||
print.println(" Assert.assertFalse(" + GenModelAccess.getGenPackage(noLit, rs).isLiteralsInterface()
|
||||
+ ");");
|
||||
|
|
|
@ -14,9 +14,10 @@ import org.eclipse.xtext.AbstractRule;
|
|||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
|
@ -24,7 +25,7 @@ import org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFin
|
|||
public class ElementFinderTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
}
|
||||
|
@ -41,25 +42,25 @@ public class ElementFinderTest extends AbstractXtextTests {
|
|||
};
|
||||
}
|
||||
|
||||
public void testKeywords() {
|
||||
@Test public void testKeywords() {
|
||||
assertEquals(3, grammarFinder().findKeywords("myKeyword", "myKeyword2").size());
|
||||
}
|
||||
|
||||
public void testKeywordsFromSuperGrammar() {
|
||||
@Test public void testKeywordsFromSuperGrammar() {
|
||||
assertEquals(1, grammarFinder().findKeywords("superKeyword").size());
|
||||
}
|
||||
|
||||
public void testKeywordPairs() {
|
||||
@Test public void testKeywordPairs() {
|
||||
assertEquals(3, grammarFinder().findKeywordPairs("begin", "end").size());
|
||||
}
|
||||
|
||||
public void testFindRuleCalls() {
|
||||
@Test public void testFindRuleCalls() {
|
||||
AbstractGrammarElementFinder f = grammarFinder();
|
||||
AbstractRule r = GrammarUtil.findRuleForName(f.getGrammar(), "FinderKeywords");
|
||||
assertEquals(2, f.findRuleCalls(r).size());
|
||||
}
|
||||
|
||||
public void testFindCrossReferences() {
|
||||
@Test public void testFindCrossReferences() {
|
||||
AbstractGrammarElementFinder f = grammarFinder();
|
||||
AbstractRule r = GrammarUtil.findRuleForName(f.getGrammar(), "FQN");
|
||||
assertNotNull(r);
|
||||
|
|
|
@ -16,8 +16,9 @@ import org.eclipse.emf.ecore.resource.Resource;
|
|||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.AsubpackagePackage;
|
||||
import org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.emptyPackage.subsubpackage.SubsubpackagePackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -27,7 +28,7 @@ public class FragmentFakingEcoreResourceTest extends AbstractXtextTests {
|
|||
private EPackage metamodel;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
XtextResourceSet set = new XtextResourceSet();
|
||||
set.setClasspathURIContext(getClass());
|
||||
|
@ -36,12 +37,12 @@ public class FragmentFakingEcoreResourceTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
metamodel = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testFakedURIs_01() {
|
||||
@Test public void testFakedURIs_01() {
|
||||
ResourceSaveIndicator indicator = new ResourceSaveIndicator();
|
||||
EPackage sub = metamodel.getESubpackages().get(0);
|
||||
Resource resource = new FragmentFakingEcoreResource(URI.createURI(sub.getNsURI()), indicator);
|
||||
|
@ -65,7 +66,7 @@ public class FragmentFakingEcoreResourceTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testFakedURIs_02() {
|
||||
@Test public void testFakedURIs_02() {
|
||||
ResourceSaveIndicator indicator = new ResourceSaveIndicator();
|
||||
EPackage sub = metamodel.getESubpackages().get(0);
|
||||
Resource resource = new FragmentFakingEcoreResource(URI.createURI(sub.getNsURI()), indicator);
|
||||
|
@ -89,7 +90,7 @@ public class FragmentFakingEcoreResourceTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testSetup() {
|
||||
@Test public void testSetup() {
|
||||
assertNotNull(metamodel);
|
||||
assertTrue(metamodel.getEClassifiers().isEmpty());
|
||||
assertFalse(metamodel.getESubpackages().isEmpty());
|
||||
|
|
|
@ -8,13 +8,16 @@
|
|||
package org.eclipse.xtext.generator.grammarAccess;
|
||||
|
||||
import static org.eclipse.xtext.generator.grammarAccess.GrammarAccessUtil.*;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
public class GrammarAccessUtilTest extends TestCase {
|
||||
public class GrammarAccessUtilTest extends Assert {
|
||||
|
||||
public void testToJavaIdentifier() throws Exception {
|
||||
@Test public void testToJavaIdentifier() throws Exception {
|
||||
assertEquals("FooBar",toJavaIdentifier("foo Bar", true));
|
||||
assertEquals("Foo",toJavaIdentifier("foo;", true));
|
||||
assertEquals("foo",toJavaIdentifier("foo;", false));
|
||||
|
@ -28,11 +31,11 @@ public class GrammarAccessUtilTest extends TestCase {
|
|||
/**
|
||||
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=298492
|
||||
*/
|
||||
public void testBug() throws Exception {
|
||||
@Test public void testBug() throws Exception {
|
||||
assertEquals("HiraganaLetterRu",toJavaIdentifier("\u308B",true));
|
||||
}
|
||||
|
||||
public void testSmoke() throws Exception {
|
||||
@Test public void testSmoke() throws Exception {
|
||||
for (int i = 0; i < 4000; i++) {
|
||||
String identifier = toJavaIdentifier(String.valueOf((char)i), false);
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
|
|||
import org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.AModel;
|
||||
import org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.AsubpackagePackage;
|
||||
import org.eclipse.xtext.generator.grammarAccess.ametamodel.asubpackage.emptyPackage.subsubpackage.SubsubpackagePackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -24,14 +25,14 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public class ParserTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
EPackage.Registry.INSTANCE.put(AsubpackagePackage.eNS_URI, AsubpackagePackage.eINSTANCE);
|
||||
EPackage.Registry.INSTANCE.put(SubsubpackagePackage.eNS_URI, SubsubpackagePackage.eINSTANCE);
|
||||
with(GrammarAccessTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testInstantiate() throws Exception {
|
||||
@Test public void testInstantiate() throws Exception {
|
||||
String modelAsText = "foo bar";
|
||||
AModel model = (AModel) getModel(modelAsText);
|
||||
assertEquals(2, model.getElements().size());
|
||||
|
@ -39,7 +40,7 @@ public class ParserTest extends AbstractXtextTests {
|
|||
assertEquals(SubsubpackagePackage.Literals.ANOTHER_TYPE, model.getElements().get(1).eClass());
|
||||
}
|
||||
|
||||
public void testUriFormat() throws Exception {
|
||||
@Test public void testUriFormat() throws Exception {
|
||||
URI uri = EcoreUtil.getURI(SubsubpackagePackage.Literals.ANOTHER_TYPE);
|
||||
assertTrue(AsubpackagePackage.eNS_URI.equals(uri.trimFragment().toString()));
|
||||
ResourceSet set = new ResourceSetImpl();
|
||||
|
@ -47,7 +48,7 @@ public class ParserTest extends AbstractXtextTests {
|
|||
assertSame(SubsubpackagePackage.Literals.ANOTHER_TYPE, eObject);
|
||||
}
|
||||
|
||||
public void testUriFormat2() throws Exception {
|
||||
@Test public void testUriFormat2() throws Exception {
|
||||
URI uri = EcoreUtil.getURI(AsubpackagePackage.Literals.ATYPE);
|
||||
assertTrue(AsubpackagePackage.eNS_URI.equals(uri.trimFragment().toString()));
|
||||
ResourceSet set = new ResourceSetImpl();
|
||||
|
|
|
@ -12,8 +12,9 @@ import org.eclipse.emf.ecore.EPackage;
|
|||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -24,7 +25,7 @@ public class SubPackageAwareGrammarAccessFragmentTest extends AbstractXtextTests
|
|||
private GrammarAccessFragment fragment;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
XtextResourceSet set = new XtextResourceSet();
|
||||
set.setClasspathURIContext(getClass());
|
||||
|
@ -34,12 +35,12 @@ public class SubPackageAwareGrammarAccessFragmentTest extends AbstractXtextTests
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
metamodel = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testMoveSubpackagesToNewResource() {
|
||||
@Test public void testMoveSubpackagesToNewResource() {
|
||||
String expected = metamodel.getESubpackages().get(0).getNsURI();
|
||||
ResourceSet set = new ResourceSetImpl();
|
||||
fragment.moveSubpackagesToNewResource(metamodel, set);
|
||||
|
|
|
@ -8,21 +8,23 @@
|
|||
package org.eclipse.xtext.generator.grammarAccess;
|
||||
|
||||
import static org.eclipse.xtext.generator.grammarAccess.UnicodeCharacterDatabaseNames.*;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
public class UnicodeCharacterDatabaseNamesTest extends TestCase {
|
||||
public class UnicodeCharacterDatabaseNamesTest extends Assert {
|
||||
|
||||
public void testGetName() throws Exception {
|
||||
@Test public void testGetName() throws Exception {
|
||||
assertEquals("LATIN SMALL LETTER U WITH DIAERESIS",getCharacterName('ü'));
|
||||
assertEquals("LATIN SMALL LETTER A WITH DIAERESIS",getCharacterName('ä'));
|
||||
assertEquals("DIGIT NINE",getCharacterName('9'));
|
||||
assertEquals("CJK UNIFIED IDEOGRAPH-4711",getCharacterName('\u4711'));
|
||||
}
|
||||
|
||||
public void testSmoke() throws Exception {
|
||||
@Test public void testSmoke() throws Exception {
|
||||
for (int i = 0; i < 8000; i++) {
|
||||
String characterName = getCharacterName((char)i);
|
||||
assertNotNull("Character : "+((char)i),characterName);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.generator.parser;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.generator.parser;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.generator.parser.antlr.AntlrGrammarGenUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* @author Heiko Behrens - Initial contribution and API
|
||||
*/
|
||||
public class AntlrGrammarGenUtilTest extends TestCase {
|
||||
public class AntlrGrammarGenUtilTest extends Assert {
|
||||
|
||||
public void testToAntlrString() throws Exception {
|
||||
@Test public void testToAntlrString() throws Exception {
|
||||
assertEquals("a\\'b\\u00D6", AntlrGrammarGenUtil.toAntlrString("a'bÖ"));
|
||||
}
|
||||
|
||||
public void testToAntlrStringIgnoreCaseSimple() throws Exception {
|
||||
@Test public void testToAntlrStringIgnoreCaseSimple() throws Exception {
|
||||
assertEquals("('A'|'a')", AntlrGrammarGenUtil.toAntlrStringIgnoreCase("a"));
|
||||
assertEquals("('A'|'a')", AntlrGrammarGenUtil.toAntlrStringIgnoreCase("A"));
|
||||
assertEquals("('A'|'a')('B'|'b')", AntlrGrammarGenUtil.toAntlrStringIgnoreCase("ab"));
|
||||
|
@ -30,16 +30,15 @@ public class AntlrGrammarGenUtilTest extends TestCase {
|
|||
assertEquals("('A'|'a')('B'|'b')", AntlrGrammarGenUtil.toAntlrStringIgnoreCase("AB"));
|
||||
}
|
||||
|
||||
public void testToAntlrStringIgnoreCaseUmlauts() throws Exception {
|
||||
@Test public void testToAntlrStringIgnoreCaseUmlauts() throws Exception {
|
||||
assertEquals("\u00D6", "Ö");
|
||||
assertEquals("\u00F6", "ö");
|
||||
assertEquals("('\\u00D6'|'\\u00F6')", AntlrGrammarGenUtil.toAntlrStringIgnoreCase("ö"));
|
||||
}
|
||||
|
||||
public void testToAntlrStringIgnoreNoCases() throws Exception {
|
||||
@Test public void testToAntlrStringIgnoreNoCases() throws Exception {
|
||||
assertEquals("\u00DF", "ß");
|
||||
//I know, eszett will have a dedicated uppercase version in future.
|
||||
//But for now...
|
||||
//TODO: eszett will have a dedicated uppercase version in future. But for now...
|
||||
assertEquals(Character.toLowerCase('ß'), Character.toUpperCase('ß'));
|
||||
|
||||
assertEquals("('A'|'a')'\\u00DF'('C'|'c')", AntlrGrammarGenUtil.toAntlrStringIgnoreCase("AßC"));
|
||||
|
|
|
@ -12,7 +12,8 @@ import org.eclipse.xtext.GrammarUtil;
|
|||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.generator.parser.antlr.TerminalRuleToLexerBody;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
//import org.eclipse.xtext.generator.parser.TerminalRuleToLexerBody;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public class TerminalRuleToLexerBodyTest extends AbstractXtextTests {
|
|||
private TerminalRule workaroundString;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
String model = "grammar foo\n" +
|
||||
|
@ -41,13 +42,13 @@ public class TerminalRuleToLexerBodyTest extends AbstractXtextTests {
|
|||
workaroundString = (TerminalRule) GrammarUtil.findRuleForName(grammar, "WORKAROUND_STRING");
|
||||
}
|
||||
|
||||
public void testToLexerBody_01() {
|
||||
@Test public void testToLexerBody_01() {
|
||||
String ada = TerminalRuleToLexerBody.toLexerBody(adaString);
|
||||
String expectation = "'\"' (~('\"')|'\"\"')* '\"'"; // '"' (~('"')|'""')* '"'
|
||||
assertEquals(expectation, ada);
|
||||
}
|
||||
|
||||
public void testToLexerBody_02() {
|
||||
@Test public void testToLexerBody_02() {
|
||||
String workaround = TerminalRuleToLexerBody.toLexerBody(workaroundString);
|
||||
String expectation = "'\"' (~('\"')|'\"' '\"')* '\"'"; // '"' (~('"')|'"' '"')* '"'
|
||||
assertEquals(expectation, workaround);
|
||||
|
|
|
@ -11,16 +11,16 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.generator.parser.antlr.ex.common.KeywordHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Heiko Behrens - Initial contribution and API
|
||||
*/
|
||||
public class KeywordHelperTest extends TestCase {
|
||||
public class KeywordHelperTest extends Assert {
|
||||
|
||||
public void testKeywordComparatorOnList() throws Exception {
|
||||
@Test public void testKeywordComparatorOnList() throws Exception {
|
||||
List<String> keywords = new ArrayList<String>();
|
||||
keywords.add("AAA");
|
||||
keywords.add("BBBB");
|
||||
|
@ -33,7 +33,7 @@ public class KeywordHelperTest extends TestCase {
|
|||
assertEquals("CC", keywords.get(3));
|
||||
}
|
||||
|
||||
public void testKeyComparatorIsolated() throws Exception {
|
||||
@Test public void testKeyComparatorIsolated() throws Exception {
|
||||
assertTrue( KeywordHelper.keywordComparator.compare("A", "B") < 0);
|
||||
assertTrue( KeywordHelper.keywordComparator.compare("B", "A") > 0);
|
||||
assertTrue( KeywordHelper.keywordComparator.compare("AA", "A") < 0);
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.regex.Pattern;
|
|||
import org.eclipse.xtext.generator.parser.AbstractAntlrSplitterTest;
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.AntlrLexerSplitter;
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.AntlrLexerSplitter.ExtractedMethod;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -22,13 +23,13 @@ import org.eclipse.xtext.generator.parser.antlr.splitting.AntlrLexerSplitter.Ext
|
|||
*/
|
||||
public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
||||
|
||||
public void testMethodSignaturePattern() throws Exception {
|
||||
@Test public void testMethodSignaturePattern() throws Exception {
|
||||
Pattern p = AntlrLexerSplitter.METHOD_SIGNATURE_PATTERN;
|
||||
assertFalse(p.matcher(" public final void mRULE_ANY_OTHER() throws RecognitionException {").find());
|
||||
assertTrue(p.matcher(" public void mTokens() throws RecognitionException {").find());
|
||||
}
|
||||
|
||||
public void testAssignmentPattern() throws Exception {
|
||||
@Test public void testAssignmentPattern() throws Exception {
|
||||
Pattern p = AntlrLexerSplitter.ASSIGNMENT_PATTERN;
|
||||
assertFalse(p.matcher(" string foo").find());
|
||||
Matcher m = p.matcher(" int alt12=16;");
|
||||
|
@ -36,7 +37,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertEquals("alt12", m.group(1));
|
||||
}
|
||||
|
||||
public void testIndentLevelPattern() throws Exception {
|
||||
@Test public void testIndentLevelPattern() throws Exception {
|
||||
Pattern p = AntlrLexerSplitter.INDENT_LEVEL_PATTERN;
|
||||
assertFalse(p.matcher("").matches());
|
||||
assertFalse(p.matcher("a b").matches());
|
||||
|
@ -46,7 +47,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
|
||||
}
|
||||
|
||||
public void testTransform() throws Exception {
|
||||
@Test public void testTransform() throws Exception {
|
||||
String content = readFileIntoString("org/eclipse/xtext/generator/parser/InternalLexerExample.java.txt");
|
||||
AntlrLexerSplitter splitter = new AntlrLexerSplitter(content);
|
||||
String actual = splitter.transform();
|
||||
|
@ -55,13 +56,13 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertTrue(!actual.equals(content));
|
||||
}
|
||||
|
||||
public void testDFAPattern() throws Exception {
|
||||
@Test public void testDFAPattern() throws Exception {
|
||||
Pattern p = AntlrLexerSplitter.DFA_ASSIGNMENT_PATTERN;
|
||||
assertTrue(p.matcher(" alt12 = dfa12.predict(input);").find());
|
||||
assertFalse(p.matcher(" int LA12_0 = input.LA(1);").find());
|
||||
}
|
||||
|
||||
public void testNoDFATransform() throws Exception {
|
||||
@Test public void testNoDFATransform() throws Exception {
|
||||
String content = readFileIntoString("org/eclipse/xtext/generator/parser/InternalLexerExample2.java.txt");
|
||||
AntlrLexerSplitter splitter = new AntlrLexerSplitter(content);
|
||||
String actual = splitter.transform();
|
||||
|
@ -69,7 +70,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertTrue(actual.equals(content));
|
||||
}
|
||||
|
||||
public void testOuterBraceInIfCascadePattern() throws Exception {
|
||||
@Test public void testOuterBraceInIfCascadePattern() throws Exception {
|
||||
Pattern p = AntlrLexerSplitter.OUTER_BRACE_IN_IF_CASCADE_PATTERN;
|
||||
Matcher m = p.matcher(" alt13=62;} ");
|
||||
assertTrue(m.find());
|
||||
|
@ -77,7 +78,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertFalse(p.matcher(" alt13=62; ").find());
|
||||
assertFalse(p.matcher(" } ").find());
|
||||
}
|
||||
public void testIfCascadeWithOneLineElse() throws Exception {
|
||||
@Test public void testIfCascadeWithOneLineElse() throws Exception {
|
||||
String content =
|
||||
" public void mTokens() throws RecognitionException {\n" +
|
||||
" // ../org.eclipse.xtext.example.domainmodel.ui/src-gen/org/eclipse/xtext/example/contentassist/antlr/internal/InternalDomainmodel.g:1:8: ( T11 | T12 | T13 | T14 | T15 | T16 | T17 | T18 | T19 | T20 | T21 | T22 | T23 | T24 | T25 | T26 | T27 | T28 | T29 | T30 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )\n" +
|
||||
|
@ -102,7 +103,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertNotNull(actual);
|
||||
}
|
||||
|
||||
public void testExtractedLine() throws Exception {
|
||||
@Test public void testExtractedLine() throws Exception {
|
||||
ExtractedMethod m = new ExtractedMethod("myVar", 1);
|
||||
assertEquals("mTokensHelper001", m.getName());
|
||||
assertEquals(" foo();", m.getAsExtractedLine(" foo();"));
|
||||
|
@ -111,7 +112,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertEquals(" return 123;}", m.getAsExtractedLine(" myVar=123;}"));
|
||||
}
|
||||
|
||||
public void testExtectedMethodSimple() throws Exception {
|
||||
@Test public void testExtectedMethodSimple() throws Exception {
|
||||
ExtractedMethod m = new ExtractedMethod("myVar", 1);
|
||||
m.addLine(" if ( someComplexExpression ) {");
|
||||
m.addLine(" myVar=1;");
|
||||
|
@ -132,7 +133,7 @@ public class AntlrLexerSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertEquals(expected, sb.toString());
|
||||
}
|
||||
|
||||
public void testExtectedMethodRemoveBreaks() throws Exception {
|
||||
@Test public void testExtectedMethodRemoveBreaks() throws Exception {
|
||||
ExtractedMethod m = new ExtractedMethod("alt12", 1);
|
||||
m.addLine(" switch ( input.LA(2) ) {");
|
||||
m.addLine(" case '*':");
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.regex.Matcher;
|
|||
import org.eclipse.xtext.generator.parser.AbstractAntlrSplitterTest;
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.AntlrParserSplitter;
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.AntlrParserSplitter.ExtractedClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -41,7 +42,7 @@ public class AntlrParserSplitterTest extends AbstractAntlrSplitterTest {
|
|||
|
||||
String DECL_AND_REF = DECLARATIONS + REFERENCES;
|
||||
|
||||
public void testDeclaration() throws Exception {
|
||||
@Test public void testDeclaration() throws Exception {
|
||||
|
||||
Matcher m = AntlrParserSplitter.DECLARATION_PATTERN.matcher(DECL_AND_REF);
|
||||
assertTrue(m.find());
|
||||
|
@ -53,7 +54,7 @@ public class AntlrParserSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertFalse(m.find());
|
||||
}
|
||||
|
||||
public void testReference() throws Exception {
|
||||
@Test public void testReference() throws Exception {
|
||||
Matcher m = AntlrParserSplitter.REFERENCE_PATTERN.matcher(DECL_AND_REF);
|
||||
assertTrue(m.find());
|
||||
assertEquals("FOLLOW_ruleModel_in_entryRuleModel60", m.group(1));
|
||||
|
@ -67,7 +68,7 @@ public class AntlrParserSplitterTest extends AbstractAntlrSplitterTest {
|
|||
assertFalse(m.find());
|
||||
}
|
||||
|
||||
public void testTransformer() throws Exception {
|
||||
@Test public void testTransformer() throws Exception {
|
||||
AntlrParserSplitter splitter = new AntlrParserSplitter(REFERENCES + DECLARATIONS);
|
||||
String actual = splitter.transform();
|
||||
assertNotNull(actual);
|
||||
|
@ -78,7 +79,7 @@ public class AntlrParserSplitterTest extends AbstractAntlrSplitterTest {
|
|||
// System.out.println(ec.getContent());
|
||||
}
|
||||
|
||||
public void testRealworld() throws Exception {
|
||||
@Test public void testRealworld() throws Exception {
|
||||
String _class = readFileIntoString("org/eclipse/xtext/generator/parser/InternalParserExample.java.txt");
|
||||
AntlrParserSplitter splitter = new AntlrParserSplitter(_class);
|
||||
String newClass = splitter.transform();
|
||||
|
|
|
@ -11,8 +11,9 @@ import org.eclipse.emf.ecore.EObject;
|
|||
import org.eclipse.xtext.generator.parser.antlr.splitting.ConditionSimplifier;
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.SimpleExpressionsStandaloneSetup;
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.simpleExpressions.IfCondition;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.util.EmfFormatter;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -23,49 +24,49 @@ public class CondititionSimplifierTest extends AbstractXtextTests {
|
|||
private ConditionSimplifier conditionSimplifier;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(SimpleExpressionsStandaloneSetup.class);
|
||||
conditionSimplifier = new ConditionSimplifier();
|
||||
}
|
||||
|
||||
public void testAorA() throws Exception {
|
||||
@Test public void testAorA() throws Exception {
|
||||
String model = "if (a||a) {";
|
||||
String expectation = "if (a) {";
|
||||
check(expectation, model);
|
||||
}
|
||||
|
||||
public void testAandA() throws Exception {
|
||||
@Test public void testAandA() throws Exception {
|
||||
String model = "if (a&&a) {";
|
||||
String expectation = "if (a) {";
|
||||
check(expectation, model);
|
||||
}
|
||||
|
||||
public void testNotNotA() throws Exception {
|
||||
@Test public void testNotNotA() throws Exception {
|
||||
String model = "if (!(!a)) {";
|
||||
String expectation = "if (a) {";
|
||||
check(expectation, model);
|
||||
}
|
||||
|
||||
public void testAorAandB() throws Exception {
|
||||
@Test public void testAorAandB() throws Exception {
|
||||
String model = "if (a||a&&b) {";
|
||||
String expectation = "if (a) {";
|
||||
check(expectation, model);
|
||||
}
|
||||
|
||||
public void testAandBorA() throws Exception {
|
||||
@Test public void testAandBorA() throws Exception {
|
||||
String model = "if (a&&b||a) {";
|
||||
String expectation = "if (a) {";
|
||||
check(expectation, model);
|
||||
}
|
||||
|
||||
public void testAandBorAandB() throws Exception {
|
||||
@Test public void testAandBorAandB() throws Exception {
|
||||
String model = "if (a&&b||a&&b) {";
|
||||
String expectation = "if (a&&b) {";
|
||||
check(expectation, model);
|
||||
}
|
||||
|
||||
public void testNotAorBorBorNotAorB() throws Exception {
|
||||
@Test public void testNotAorBorBorNotAorB() throws Exception {
|
||||
String model = "if (!(a||b)||b||!(a||b)) {";
|
||||
String expectation = "if (!(a||b)||b) {";
|
||||
check(expectation, model);
|
||||
|
|
|
@ -7,15 +7,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.generator.parser.splitting;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.xtext.generator.parser.antlr.splitting.internal.LexerSpecialStateTransitionSplitter;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public class LexerSpecialStateTransitionSplitterTest extends TestCase {
|
||||
public class LexerSpecialStateTransitionSplitterTest extends Assert {
|
||||
|
||||
private String original =
|
||||
"public class InternalMyDslLexer extends Lexer {\n" +
|
||||
|
@ -127,20 +129,18 @@ public class LexerSpecialStateTransitionSplitterTest extends TestCase {
|
|||
|
||||
private LexerSpecialStateTransitionSplitter testMe;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
testMe = new LexerSpecialStateTransitionSplitter(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
original = null;
|
||||
transformed = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testTransformation() {
|
||||
@Test public void testTransformation() {
|
||||
String actual = testMe.transform(original);
|
||||
assertEquals(transformed, actual);
|
||||
}
|
||||
|
|
|
@ -7,13 +7,14 @@ import org.eclipse.emf.common.util.URI;
|
|||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ResourceTest extends AbstractXtextTests {
|
||||
|
||||
// FIXME: Make this test work again
|
||||
|
||||
// public void testResource() throws Exception {
|
||||
// @Test public void testResource() throws Exception {
|
||||
// new Object(); // workaround for Java bug on MacOSX
|
||||
// IServiceScope serviceScope = ServiceScopeFactory.get(ITestLanguage.ID);
|
||||
// IResourceFactory resourceFactory = ServiceRegistry.getService(serviceScope, IResourceFactory.class);
|
||||
|
@ -39,7 +40,7 @@ public class ResourceTest extends AbstractXtextTests {
|
|||
// assertFalse(ecoreModelComparator.modelsDiffer(resource, resource1));
|
||||
// }
|
||||
|
||||
public void testDoNothing(){
|
||||
@Test public void testDoNothing(){
|
||||
// 'cause JUnit doesn't like test classes without test methods.
|
||||
}
|
||||
|
||||
|
|
|
@ -11,19 +11,20 @@ package org.eclipse.xtext.grammarinheritance;
|
|||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.xtext.grammarinheritance.ametamodel.AmetamodelPackage;
|
||||
import org.eclipse.xtext.grammarinheritance.services.InheritanceTest2LanguageGrammarAccess;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AnotherInheritanceTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
EPackage aMetamodel = AmetamodelPackage.eINSTANCE;
|
||||
EPackage.Registry.INSTANCE.put(aMetamodel.getNsURI(), aMetamodel);
|
||||
with(new InheritanceTest2LanguageStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
@Test public void testSimple() throws Exception {
|
||||
InheritanceTest2LanguageGrammarAccess g = (InheritanceTest2LanguageGrammarAccess) getGrammarAccess();
|
||||
assertNotNull(g.getFQNAccess());
|
||||
assertNotNull(g.getModelAccess());
|
||||
|
|
|
@ -10,7 +10,8 @@ package org.eclipse.xtext.grammarinheritance;
|
|||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -18,12 +19,12 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public class Bug265111Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testParseGrammar() throws Exception {
|
||||
@Test public void testParseGrammar() throws Exception {
|
||||
String grammar = "grammar test with org.eclipse.xtext.grammarinheritance.BaseInheritanceTestLanguage\n" +
|
||||
"generate test 'http://test'\n" +
|
||||
"Root: A | Model;" +
|
||||
|
|
|
@ -13,7 +13,8 @@ import org.eclipse.emf.ecore.EPackage;
|
|||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.grammarinheritance.services.InheritanceTestLanguageGrammarAccess;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -23,13 +24,13 @@ public class Inheritance2Test extends AbstractXtextTests {
|
|||
private InheritanceTestLanguageGrammarAccess grammarAccess;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(InheritanceTestLanguageStandaloneSetup.class);
|
||||
grammarAccess = get(InheritanceTestLanguageGrammarAccess.class);
|
||||
}
|
||||
|
||||
public void testReturnTypes_01() {
|
||||
@Test public void testReturnTypes_01() {
|
||||
ParserRule rule = grammarAccess.getModelRule();
|
||||
EClassifier classifier = rule.getType().getClassifier();
|
||||
assertEquals("Model", classifier.getName());
|
||||
|
@ -43,7 +44,7 @@ public class Inheritance2Test extends AbstractXtextTests {
|
|||
assertEquals(grammarAccess.getGrammar().getUsedGrammars().get(0).getMetamodelDeclarations().get(0).getEPackage(), superPack);
|
||||
}
|
||||
|
||||
public void testReturnTypes_02() {
|
||||
@Test public void testReturnTypes_02() {
|
||||
ParserRule rule = grammarAccess.getElementRule();
|
||||
EClassifier classifier = rule.getType().getClassifier();
|
||||
assertEquals("Element", classifier.getName());
|
||||
|
@ -52,7 +53,7 @@ public class Inheritance2Test extends AbstractXtextTests {
|
|||
assertEquals(grammarAccess.getGrammar().getMetamodelDeclarations().get(0).getEPackage(), pack);
|
||||
}
|
||||
|
||||
public void testParse_01() throws Exception {
|
||||
@Test public void testParse_01() throws Exception {
|
||||
String model = "model foo { element bar }";
|
||||
Resource resource = getResourceFromString(model);
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
|
|
|
@ -14,14 +14,15 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
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.TypeRef;
|
||||
import org.eclipse.xtext.grammarinheritance.ametamodel.AmetamodelPackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.grammarinheritance.foo.ConcreteParserRule;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -35,21 +36,21 @@ public class InheritanceTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
EPackage aMetamodel = AmetamodelPackage.eINSTANCE;
|
||||
EPackage.Registry.INSTANCE.put(aMetamodel.getNsURI(), aMetamodel);
|
||||
with(new ConcreteTestLanguageStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
EObject model = getModel("model 23.34 : element A element B");
|
||||
assertEquals(23.34, invokeWithXtend("magicNumber", model));
|
||||
assertWithXtend("'A'", "elements.get(0).name", model);
|
||||
assertWithXtend("'B'", "elements.get(1).name", model);
|
||||
@Test public void testSimple() throws Exception {
|
||||
ConcreteParserRule model = (ConcreteParserRule) getModel("model 23.34 : element A element B");
|
||||
assertEquals(23.34, model.getMagicNumber(), 0.0001);
|
||||
assertEquals("A", model.getElements().get(0).getName());
|
||||
assertEquals("B", model.getElements().get(1).getName());
|
||||
}
|
||||
|
||||
public void testMetamodel() throws Exception {
|
||||
@Test public void testMetamodel() throws Exception {
|
||||
AbstractRule rule = GrammarUtil.findRuleForName(getGrammarAccess().getGrammar(), "OverridableParserRule2");
|
||||
assertNotNull("rule", rule);
|
||||
TypeRef ref = rule.getType();
|
||||
|
|
|
@ -19,10 +19,11 @@ import org.eclipse.xtext.GrammarUtil;
|
|||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.grammarinheritance.ametamodel.AmetamodelPackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.xtext.ecoreInference.Xtext2EcoreTransformer;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -31,13 +32,13 @@ public class ToEcoreTrafoTest extends AbstractXtextTests {
|
|||
private static final Logger logger = Logger.getLogger(ToEcoreTrafoTest.class);
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new XtextStandaloneSetup());
|
||||
EPackage.Registry.INSTANCE.put(AmetamodelPackage.eNS_URI, AmetamodelPackage.eINSTANCE);
|
||||
}
|
||||
|
||||
public void testAbstractLanguageToMetamodel() throws Exception {
|
||||
@Test public void testAbstractLanguageToMetamodel() throws Exception {
|
||||
XtextResource r = getResource("classpath:/" + AbstractTestLanguage.class.getName().replace('.', '/') + ".xtext");
|
||||
Grammar element = (Grammar) r.getParseResult().getRootASTElement();
|
||||
if (!r.getErrors().isEmpty()) {
|
||||
|
@ -55,7 +56,7 @@ public class ToEcoreTrafoTest extends AbstractXtextTests {
|
|||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
public void testConcreteLanguageToMetamodel() throws Exception {
|
||||
@Test public void testConcreteLanguageToMetamodel() throws Exception {
|
||||
XtextResource r = getResource("classpath:/" + ConcreteTestLanguage.class.getName().replace('.', '/') + ".xtext");
|
||||
Grammar element = (Grammar) r.getContents().get(0);
|
||||
List<TerminalRule> lexerRules = GrammarUtil.allTerminalRules(element);
|
||||
|
@ -72,7 +73,7 @@ public class ToEcoreTrafoTest extends AbstractXtextTests {
|
|||
assertNotNull(feature.getEType());
|
||||
}
|
||||
|
||||
public void testConcreteLanguageToMetamodel1() throws Exception {
|
||||
@Test public void testConcreteLanguageToMetamodel1() throws Exception {
|
||||
XtextResource r = getResource("classpath:/" + ConcreteTestLanguage.class.getName().replace('.', '/') + ".xtext");
|
||||
EObject element = r.getContents().get(0);
|
||||
Grammar g = (Grammar) element;
|
||||
|
@ -97,8 +98,4 @@ public class ToEcoreTrafoTest extends AbstractXtextTests {
|
|||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] importedExtensions() {
|
||||
return new String[] { "org::eclipse::xtext::ecore::Xtext2Ecore" };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
package org.eclipse.xtext.lexer;
|
||||
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.lexer.backtrackingTestLanguage.Model;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -17,12 +18,12 @@ import org.eclipse.xtext.lexer.backtrackingTestLanguage.Model;
|
|||
public class Bug282355Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(BacktrackingLexerTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testBug282355_01() throws Exception {
|
||||
@Test public void testBug282355_01() throws Exception {
|
||||
Resource resource = getResourceFromString("Abc Efg Xb");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -34,7 +35,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(0, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testBug282355_02() throws Exception {
|
||||
@Test public void testBug282355_02() throws Exception {
|
||||
Resource resource = getResourceFromString("Xb");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -46,7 +47,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(0, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testBug282355_03() throws Exception {
|
||||
@Test public void testBug282355_03() throws Exception {
|
||||
Resource resource = getResourceFromString("Ab");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -58,7 +59,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(0, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testBug282355_04() throws Exception {
|
||||
@Test public void testBug282355_04() throws Exception {
|
||||
Resource resource = getResourceFromString("Abc Efg Ab Xb");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -70,7 +71,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(0, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testBug282355_05() throws Exception {
|
||||
@Test public void testBug282355_05() throws Exception {
|
||||
Resource resource = getResourceFromString("AbcEfgAbXb");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -82,7 +83,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(0, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testParse_Yc_01() throws Exception {
|
||||
@Test public void testParse_Yc_01() throws Exception {
|
||||
Resource resource = getResourceFromString("Abc Efg Yc");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -94,7 +95,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(1, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testParse_Yc_02() throws Exception {
|
||||
@Test public void testParse_Yc_02() throws Exception {
|
||||
Resource resource = getResourceFromString("YcYc");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -106,7 +107,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(2, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testParse_YcAA() throws Exception {
|
||||
@Test public void testParse_YcAA() throws Exception {
|
||||
Resource resource = getResourceFromString("YcAA");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -118,7 +119,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(1, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testParse_YA() throws Exception {
|
||||
@Test public void testParse_YA() throws Exception {
|
||||
Resource resource = getResourceFromString("YA");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
@ -130,7 +131,7 @@ public class Bug282355Test extends AbstractXtextTests {
|
|||
assertEquals(0, model.getYcs().size());
|
||||
}
|
||||
|
||||
public void testParse_A() throws Exception {
|
||||
@Test public void testParse_A() throws Exception {
|
||||
Resource resource = getResourceFromString("A");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
|
|
|
@ -12,8 +12,9 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.antlr.runtime.Token;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
@ -25,7 +26,7 @@ public class Bug313508Test extends AbstractXtextTests {
|
|||
private Map<Integer, String> map;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(BacktrackingLexerTestLanguageStandaloneSetup.class);
|
||||
ITokenDefProvider tokenDefProvider = get(ITokenDefProvider.class);
|
||||
|
@ -33,16 +34,16 @@ public class Bug313508Test extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
map = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testSize() {
|
||||
@Test public void testSize() {
|
||||
assertEquals(8 /* terminal rules */ + 2 /* keywords */, map.size());
|
||||
}
|
||||
|
||||
public void testKeys() {
|
||||
@Test public void testKeys() {
|
||||
Set<Integer> expected = Sets.newHashSet(
|
||||
Token.MIN_TOKEN_TYPE + 0,
|
||||
Token.MIN_TOKEN_TYPE + 1,
|
||||
|
@ -58,7 +59,7 @@ public class Bug313508Test extends AbstractXtextTests {
|
|||
assertEquals(expected, map.keySet());
|
||||
}
|
||||
|
||||
public void testValues() {
|
||||
@Test public void testValues() {
|
||||
Collection<String> tokens = map.values();
|
||||
assertTrue(tokens.contains("'Abc'"));
|
||||
assertTrue(tokens.contains("'Efg'"));
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.lexer;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.lexer.ignoreCaseTestLanguage.Model;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Heiko Behrens - Initial contribution and API
|
||||
|
@ -18,7 +19,7 @@ import org.eclipse.xtext.resource.XtextResource;
|
|||
public class IgnoreCaseTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(IgnoreCaseLexerTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
@ -28,46 +29,46 @@ public class IgnoreCaseTest extends AbstractXtextTests {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void testLowercase() throws Exception {
|
||||
@Test public void testLowercase() throws Exception {
|
||||
XtextResource resource = getResourceFromString("case case");
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
assertNotNull(model);
|
||||
assertEquals("case", model.getValue());
|
||||
}
|
||||
|
||||
public void testUppercase() throws Exception {
|
||||
@Test public void testUppercase() throws Exception {
|
||||
XtextResource resource = getResourceFromString("CASE CASE");
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
assertNotNull(model);
|
||||
assertEquals("CASE", model.getValue());
|
||||
}
|
||||
|
||||
public void testMixedCase() throws Exception {
|
||||
@Test public void testMixedCase() throws Exception {
|
||||
XtextResource resource = getResourceFromString("CaSe cAsE");
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
assertNotNull(model);
|
||||
assertEquals("cAsE", model.getValue());
|
||||
}
|
||||
|
||||
public void testSerializeLowercase() throws Exception {
|
||||
@Test public void testSerializeLowercase() throws Exception {
|
||||
Model model = getModel("case case");
|
||||
String serialized = serialize(model);
|
||||
assertEquals("case case", serialized);
|
||||
}
|
||||
|
||||
public void testSerializeUppercase() throws Exception {
|
||||
@Test public void testSerializeUppercase() throws Exception {
|
||||
Model model = getModel("CASE CASE");
|
||||
String serialized = serialize(model);
|
||||
assertEquals("CASE CASE", serialized);
|
||||
}
|
||||
|
||||
public void testSerializeMixedCase() throws Exception {
|
||||
@Test public void testSerializeMixedCase() throws Exception {
|
||||
Model model = getModel("CaSe CaSe");
|
||||
String serialized = serialize(model);
|
||||
assertEquals("CaSe CaSe", serialized);
|
||||
}
|
||||
|
||||
public void testSerializeInvertedMixedCase() throws Exception {
|
||||
@Test public void testSerializeInvertedMixedCase() throws Exception {
|
||||
Model model = getModel("cAsE cAsE");
|
||||
String serialized = serialize(model);
|
||||
assertEquals("cAsE cAsE", serialized);
|
||||
|
|
|
@ -8,18 +8,18 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.lexer;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.antlr.runtime.ANTLRStringStream;
|
||||
import org.antlr.runtime.CommonTokenStream;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.xtext.testlanguages.parser.antlr.internal.InternalSimpleExpressionsTestLanguageLexer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LexerErrorTest extends TestCase {
|
||||
public class LexerErrorTest extends Assert {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(LexerErrorTest.class);
|
||||
|
||||
public void testLexerError() throws Exception {
|
||||
@Test public void testLexerError() throws Exception {
|
||||
String model = "a /* uncomplete comment *";
|
||||
InternalSimpleExpressionsTestLanguageLexer lexer = new InternalSimpleExpressionsTestLanguageLexer();
|
||||
lexer.setCharStream(new ANTLRStringStream(model));
|
||||
|
|
|
@ -8,19 +8,19 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.lexer;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.antlr.runtime.ANTLRStringStream;
|
||||
import org.antlr.runtime.CommonToken;
|
||||
import org.antlr.runtime.CommonTokenStream;
|
||||
import org.eclipse.xtext.testlanguages.parser.antlr.internal.InternalSimpleExpressionsTestLanguageLexer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Dennis Hübner - Initial contribution and API
|
||||
*
|
||||
*/
|
||||
public class LexerSLComment extends TestCase {
|
||||
public void testSlComment() {
|
||||
public class LexerSLComment extends Assert {
|
||||
@Test public void testSlComment() {
|
||||
String model = "//sl comment\na";
|
||||
InternalSimpleExpressionsTestLanguageLexer lexer = new InternalSimpleExpressionsTestLanguageLexer();
|
||||
lexer.setCharStream(new ANTLRStringStream(model));
|
||||
|
@ -34,7 +34,7 @@ public class LexerSLComment extends TestCase {
|
|||
* see BUG 234135: Comments on EOF not detected
|
||||
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=234135
|
||||
*/
|
||||
public void testSlCommentEOF() {
|
||||
@Test public void testSlCommentEOF() {
|
||||
String model = "a\n//sl comment";
|
||||
InternalSimpleExpressionsTestLanguageLexer lexer = new InternalSimpleExpressionsTestLanguageLexer();
|
||||
lexer.setCharStream(new ANTLRStringStream(model));
|
||||
|
|
|
@ -7,24 +7,25 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.linking;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public abstract class AbstractIgnoreCaseLinkingTest extends AbstractXtextTests {
|
||||
|
||||
public void testSimpleModel() throws Exception {
|
||||
@Test public void testSimpleModel() throws Exception {
|
||||
String input = "a A {}";
|
||||
getModel(input);
|
||||
}
|
||||
|
||||
public void testNestedModel() throws Exception {
|
||||
@Test public void testNestedModel() throws Exception {
|
||||
String input = "a A { b a { c B {} c a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
||||
public void testUnresolvedLink() throws Exception {
|
||||
@Test public void testUnresolvedLink() throws Exception {
|
||||
String input = "a notFound {}";
|
||||
getModelAndExpect(input, 1);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,10 @@ import org.eclipse.emf.ecore.resource.Resource;
|
|||
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||
import org.eclipse.emf.ecore.resource.URIHandler;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -29,12 +30,12 @@ import org.eclipse.xtext.util.StringInputStream;
|
|||
public class Bug266082Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(ImportUriTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testCircularImports() {
|
||||
@Test public void testCircularImports() {
|
||||
XtextResourceSet resourceSet = get(XtextResourceSet.class);
|
||||
resourceSet.setClasspathURIContext(getClass().getClassLoader());
|
||||
URI uri = URI.createURI("classpath:/org/eclipse/xtext/linking/01.importuritestlanguage");
|
||||
|
@ -44,7 +45,7 @@ public class Bug266082Test extends AbstractXtextTests {
|
|||
assertFalse(res.getErrors().toString(), res.getErrors().isEmpty());
|
||||
}
|
||||
|
||||
public void testManyUnresolvedImports() throws Exception {
|
||||
@Test public void testManyUnresolvedImports() throws Exception {
|
||||
StringBuilder model = new StringBuilder(200000);
|
||||
int max = 10000;
|
||||
for(int i = 1; i <= max; i++) {
|
||||
|
@ -55,7 +56,7 @@ public class Bug266082Test extends AbstractXtextTests {
|
|||
assertEquals(res.getErrors().toString(), 1, res.getErrors().size());
|
||||
}
|
||||
|
||||
public void testManyResolvedImports() throws Exception {
|
||||
@Test public void testManyResolvedImports() throws Exception {
|
||||
StringBuilder model = new StringBuilder(2000);
|
||||
int max = 100;
|
||||
for(int i = 1; i <= max; i++) {
|
||||
|
@ -133,7 +134,7 @@ public class Bug266082Test extends AbstractXtextTests {
|
|||
assertEquals(res.getErrors().toString(), 1, res.getErrors().size());
|
||||
}
|
||||
|
||||
public void testRedundantImport() {
|
||||
@Test public void testRedundantImport() {
|
||||
XtextResourceSet resourceSet = get(XtextResourceSet.class);
|
||||
resourceSet.setClasspathURIContext(getClass().getClassLoader());
|
||||
URI uri = URI.createURI("classpath:/org/eclipse/xtext/linking/03.importuritestlanguage");
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
package org.eclipse.xtext.linking;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.bug287988Test.BaseAttribute;
|
||||
import org.eclipse.xtext.linking.bug287988Test.Model;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -19,23 +20,17 @@ import org.eclipse.xtext.resource.XtextResource;
|
|||
public class Bug287988Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected boolean shouldTestSerializer(XtextResource resource) {
|
||||
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361355
|
||||
return !"testInlinedActions_01".equals(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(Bug287988TestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testAction_01() throws Exception {
|
||||
@Test public void testAction_01() throws Exception {
|
||||
String modelAsString = "actions master mytype attr1; attribute ref attr1 attr2;";
|
||||
checkSecondAttrRefersToFirst(modelAsString);
|
||||
}
|
||||
|
||||
public void testAction_02() throws Exception {
|
||||
@Test public void testAction_02() throws Exception {
|
||||
String modelAsString = "actions master mytype attr1; attribute myOtherType attr2;";
|
||||
Model model = (Model) getModel(modelAsString);
|
||||
assertEquals(2, model.getAttributes().size());
|
||||
|
@ -43,7 +38,7 @@ public class Bug287988Test extends AbstractXtextTests {
|
|||
assertNull(baseAttribute.getTypeRef());
|
||||
}
|
||||
|
||||
public void testAction_03() throws Exception {
|
||||
@Test public void testAction_03() throws Exception {
|
||||
String modelAsString = "actions master mytype attr1; attribute ref attr3 attr2;";
|
||||
Model model = (Model) getModelAndExpect(modelAsString, 1);
|
||||
assertEquals(2, model.getAttributes().size());
|
||||
|
@ -53,27 +48,29 @@ public class Bug287988Test extends AbstractXtextTests {
|
|||
assertTrue(eObject.eIsProxy());
|
||||
}
|
||||
|
||||
public void testSimple_01() throws Exception {
|
||||
@Test public void testSimple_01() throws Exception {
|
||||
String modelAsString = "simple mytype attr1; ref attr1 attr2;";
|
||||
checkSecondAttrRefersToFirst(modelAsString);
|
||||
}
|
||||
|
||||
public void testRuleCall_01() throws Exception {
|
||||
@Test public void testRuleCall_01() throws Exception {
|
||||
String modelAsString = "rulecall mytype attr1; ref attr1 attr2;";
|
||||
checkSecondAttrRefersToFirst(modelAsString);
|
||||
}
|
||||
|
||||
public void testRuleCall_02() throws Exception {
|
||||
@Test public void testRuleCall_02() throws Exception {
|
||||
String modelAsString = "rulecall2 attr1 mytype; attr2 ref attr1;";
|
||||
checkSecondAttrRefersToFirst(modelAsString);
|
||||
}
|
||||
|
||||
public void testRuleCall_03() throws Exception {
|
||||
@Test public void testRuleCall_03() throws Exception {
|
||||
String modelAsString = "rulecall3 call me attr1 mytype; call me attr2 ref attr1;";
|
||||
checkSecondAttrRefersToFirst(modelAsString);
|
||||
}
|
||||
|
||||
public void testInlinedActions_01() throws Exception {
|
||||
@Test public void testInlinedActions_01() throws Exception {
|
||||
// TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=361355
|
||||
disableSerializerTest();
|
||||
String modelAsString = "inlinedActions master mytype attr1; attribute ref attr1 attr2;";
|
||||
checkSecondAttrRefersToFirst(modelAsString);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.xtext.linking.bug287988Test.Model;
|
|||
import org.eclipse.xtext.linking.impl.Linker;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -27,7 +28,7 @@ public class Bug287988WithEagerLinkingTest extends Bug287988Test {
|
|||
private ResourceFactoryImpl factory;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
factory = new ResourceFactoryImpl(){
|
||||
@Override
|
||||
|
@ -54,7 +55,7 @@ public class Bug287988WithEagerLinkingTest extends Bug287988Test {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void testAction_03() throws Exception {
|
||||
@Test public void testAction_03() throws Exception {
|
||||
String modelAsString = "actions master mytype attr1; attribute ref attr3 attr2;";
|
||||
Model model = (Model) getModelAndExpect(modelAsString, 1);
|
||||
assertEquals(2, model.getAttributes().size());
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.linking;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
|
@ -15,17 +16,17 @@ import org.eclipse.xtext.junit.AbstractXtextTests;
|
|||
public class Bug313089Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(Bug313089TestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testUnassignedAction() throws Exception {
|
||||
@Test public void testUnassignedAction() throws Exception {
|
||||
getModelAndExpect("foo bar foo", 0);
|
||||
|
||||
}
|
||||
|
||||
public void testAssignedAction() throws Exception {
|
||||
@Test public void testAssignedAction() throws Exception {
|
||||
getModelAndExpect("foo baz baz0 baz baz1 foo",0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,11 @@ package org.eclipse.xtext.linking;
|
|||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.bug362902.Model;
|
||||
import org.eclipse.xtext.linking.impl.XtextLinkingDiagnostic;
|
||||
import org.eclipse.xtext.resource.XtextSyntaxDiagnostic;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Holger Schill - Initial contribution and API
|
||||
|
@ -20,12 +21,12 @@ import org.eclipse.xtext.resource.XtextSyntaxDiagnostic;
|
|||
public class Bug362902Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(Bug362902StandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testNoExceptionUncaught() throws Exception {
|
||||
@Test public void testNoExceptionUncaught() throws Exception {
|
||||
String modelAsString = "Hello max ! Hello peter! favourite peter";
|
||||
Model model = (Model)getModelAndExpect(modelAsString, 2);
|
||||
EList<Diagnostic> errors = model.eResource().getErrors();
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.eclipse.xtext.linking;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
|
@ -13,7 +12,7 @@ import org.eclipse.xtext.Assignment;
|
|||
import org.eclipse.xtext.CrossReference;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.IGrammarAccess;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.impl.DefaultLinkingService;
|
||||
import org.eclipse.xtext.linking.impl.IllegalNodeException;
|
||||
import org.eclipse.xtext.linking.langATestLanguage.LangATestLanguageFactory;
|
||||
|
@ -32,13 +31,13 @@ import org.eclipse.xtext.parsetree.reconstr.ITokenSerializer.ICrossReferenceSeri
|
|||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.service.SingletonBinding;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
public class CrossRefTest extends AbstractXtextTests {
|
||||
private static final Logger logger = Logger.getLogger(CrossRefTest.class);
|
||||
private ICrossReferenceSerializer crossRefSerializer;
|
||||
private LangATestLanguageGrammarAccess grammar;
|
||||
|
||||
|
@ -76,7 +75,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new LangATestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
|
@ -94,21 +93,20 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
grammar = (LangATestLanguageGrammarAccess) get(IGrammarAccess.class);
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
EObject model = getModel("type A extends B type B extends A");
|
||||
logger.debug(invokeWithXtend("types.collect(e|e.name+' '+e.extends.name).toString(',')", model));
|
||||
assertWithXtend("'B'", "types.first().extends.name", model);
|
||||
assertWithXtend("types.first()", "types.first().extends.extends", model);
|
||||
@Test public void testSimple() throws Exception {
|
||||
Main model = (Main) getModel("type A extends B type B extends A");
|
||||
assertEquals("B", model.getTypes().get(0).getExtends().getName());
|
||||
assertEquals(model.getTypes().get(0), model.getTypes().get(0).getExtends().getExtends());
|
||||
}
|
||||
|
||||
public void testGetLinkedObjects() throws Exception {
|
||||
@Test public void testGetLinkedObjects() throws Exception {
|
||||
XtextResource r = getResourceFromString("type TypeA extends TypeB type TypeB extends TypeA type AnotherType extends TypeA");
|
||||
EObject model = r.getParseResult().getRootASTElement();
|
||||
Main model = (Main) r.getParseResult().getRootASTElement();
|
||||
ILeafNode leaf = NodeModelUtils.findLeafNodeAtOffset(r.getParseResult().getRootNode(), 6);
|
||||
|
||||
assertWithXtend("3", "types.size", model);
|
||||
assertEquals(3, model.getTypes().size());
|
||||
|
||||
EObject context = (EObject) invokeWithXtend("types.first()", model);
|
||||
EObject context = model.getTypes().get(0);
|
||||
Assignment asExtends = get(LangATestLanguageGrammarAccess.class).getTypeAccess().getExtendsAssignment_2_1();
|
||||
CrossReference xref = (CrossReference) asExtends.getTerminal();
|
||||
EReference ref = GrammarUtil.getReference(xref, context.eClass());
|
||||
|
@ -116,7 +114,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
assertEquals(1, getLinkingService().getLinkedObjects(context, ref, leaf).size());
|
||||
}
|
||||
|
||||
public void testGetSingleValuedLinkText() throws Exception {
|
||||
@Test public void testGetSingleValuedLinkText() throws Exception {
|
||||
XtextResource r = getResourceFromStringAndExpect("type TypeA extends ^extends type ^extends extends ^type", 1);
|
||||
Main model = (Main) r.getContents().get(0);
|
||||
assertEquals(2, model.getTypes().size());
|
||||
|
@ -140,7 +138,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
assertNull(linkText);
|
||||
}
|
||||
|
||||
public void testGetMultiValuedLinkText() throws Exception {
|
||||
@Test public void testGetMultiValuedLinkText() throws Exception {
|
||||
with(LazyLinkingTestLanguageStandaloneSetup.class);
|
||||
crossRefSerializer = get(ICrossReferenceSerializer.class);
|
||||
LazyLinkingTestLanguageGrammarAccess g = (LazyLinkingTestLanguageGrammarAccess) get(IGrammarAccess.class);
|
||||
|
@ -182,7 +180,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
/* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=287813 */
|
||||
public void testNonDefaultLinkText() throws Exception {
|
||||
@Test public void testNonDefaultLinkText() throws Exception {
|
||||
XtextResource r = getResourceFromString("type TypeA extends ^TypeB type TypeB");
|
||||
Main model = (Main) r.getContents().get(0);
|
||||
assertEquals(2, model.getTypes().size());
|
||||
|
@ -197,7 +195,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
/* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=325435 */
|
||||
public void testSerializingProxiedCrossReference() throws Exception {
|
||||
@Test public void testSerializingProxiedCrossReference() throws Exception {
|
||||
XtextResource r = getResourceFromString("type TypeA extends ^TypeB type TypeB ");
|
||||
Main model = (Main) r.getContents().get(0);
|
||||
|
||||
|
@ -215,7 +213,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
/* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=287813 */
|
||||
public void testOutOfSyncNodeModel() throws Exception {
|
||||
@Test public void testOutOfSyncNodeModel() throws Exception {
|
||||
XtextResource r = getResourceFromString("type TypeA extends ^TypeB type TypeB ");
|
||||
Main model = (Main) r.getContents().get(0);
|
||||
|
||||
|
@ -228,7 +226,7 @@ public class CrossRefTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
/* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=298506 */
|
||||
public void testCrossReferenceValueConverter() throws Exception {
|
||||
@Test public void testCrossReferenceValueConverter() throws Exception {
|
||||
Resource r = get(XtextResourceSet.class).createResource(URI.createURI("test." + getCurrentFileExtension()));
|
||||
Main main = LangATestLanguageFactory.eINSTANCE.createMain();
|
||||
Type ele = LangATestLanguageFactory.eINSTANCE.createType();
|
||||
|
|
|
@ -10,6 +10,7 @@ package org.eclipse.xtext.linking;
|
|||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Guice;
|
||||
|
@ -29,7 +30,7 @@ public class IgnoreCaseLinkingWithDifferentWildcardTest extends AbstractIgnoreCa
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new IgnoreCaseNamespacesTestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
|
@ -45,22 +46,22 @@ public class IgnoreCaseLinkingWithDifferentWildcardTest extends AbstractIgnoreCa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void testWithImports() throws Exception {
|
||||
@Test public void testWithImports() throws Exception {
|
||||
String input = "'a.b.all' a C { b a { c B {} d a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
||||
public void testWithImportsIgnoreCase_01() throws Exception {
|
||||
@Test public void testWithImportsIgnoreCase_01() throws Exception {
|
||||
String input = "'A.B.all' a C { b a { c B {} d a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
||||
public void testWithImportsIgnoreCase_02() throws Exception {
|
||||
@Test public void testWithImportsIgnoreCase_02() throws Exception {
|
||||
String input = "'A.B.ALL' a C { b a { c B {} d a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
||||
public void testWithImportsIgnoreCase_03() throws Exception {
|
||||
@Test public void testWithImportsIgnoreCase_03() throws Exception {
|
||||
String input = "'a.b.ALL' a C { b a { c B {} d a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
|
|
@ -7,24 +7,26 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.linking;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public class IgnoreCaseLinkingWithNamespaceImportsTest extends AbstractIgnoreCaseLinkingTest {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(IgnoreCaseNamespacesTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testWithImports() throws Exception {
|
||||
@Test public void testWithImports() throws Exception {
|
||||
String input = "'a.b.*' a C { b a { c B {} d a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
||||
public void testWithImportsIgnoreCase_01() throws Exception {
|
||||
@Test public void testWithImportsIgnoreCase_01() throws Exception {
|
||||
String input = "'A.B.*' a C { b a { c B {} d a {} } }";
|
||||
getModel(input);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.eclipse.xtext.resource.XtextResource;
|
|||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.scoping.impl.SyntheticModelAwareURIConverter;
|
||||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -20,13 +21,13 @@ import org.eclipse.xtext.util.StringInputStream;
|
|||
public class IgnoreCaseLinkingWithURIImportsTest extends AbstractIgnoreCaseLinkingTest {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(IgnoreCaseImportsTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testWithImports() throws Exception {
|
||||
@Test public void testWithImports() throws Exception {
|
||||
SyntheticModelAwareURIConverter uriConverter = new SyntheticModelAwareURIConverter();
|
||||
XtextResourceSet resourceSet = get(XtextResourceSet.class);
|
||||
resourceSet.setURIConverter(uriConverter);
|
||||
|
|
|
@ -14,8 +14,10 @@ import org.eclipse.emf.ecore.resource.Resource;
|
|||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.diagnostics.Diagnostic;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.langATestLanguage.Main;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Heiko Behrens - Initial contribution and API
|
||||
|
@ -25,23 +27,23 @@ public class LinkingErrorTest extends AbstractXtextTests {
|
|||
private static final Logger logger = Logger.getLogger(CrossRefTest.class);
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(LangATestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testNoErrors() throws Exception {
|
||||
@Test public void testNoErrors() throws Exception {
|
||||
XtextResource resource = getResourceFromString(" type A extends B \n type B extends A");
|
||||
EObject model = getModel(resource);
|
||||
assertWithXtend("2", "types.size", model);
|
||||
Main model = (Main) getModel(resource);
|
||||
assertEquals(2, model.getTypes().size());
|
||||
assertEquals(0, resource.getErrors().size());
|
||||
assertEquals(0, resource.getWarnings().size());
|
||||
}
|
||||
|
||||
public void testLinkError() throws Exception {
|
||||
@Test public void testLinkError() throws Exception {
|
||||
XtextResource resource = getResourceFromStringAndExpect(" type A extends B \n type B extends C", 1);
|
||||
EObject model = getModel(resource);
|
||||
assertWithXtend("2", "types.size", model);
|
||||
Main model = (Main) getModel(resource);
|
||||
assertEquals(2, model.getTypes().size());
|
||||
assertEquals(1, resource.getErrors().size());
|
||||
assertEquals(0, resource.getWarnings().size());
|
||||
|
||||
|
@ -52,7 +54,7 @@ public class LinkingErrorTest extends AbstractXtextTests {
|
|||
assertEquals(1, verboseError.getLength());
|
||||
}
|
||||
|
||||
public void testLinkingErrorMessage() throws Exception {
|
||||
@Test public void testLinkingErrorMessage() throws Exception {
|
||||
XtextResource resource = getResourceFromStringAndExpect("type A extends B", 1);
|
||||
assertEquals(1, resource.getErrors().size());
|
||||
Diagnostic error = (Diagnostic) resource.getErrors().get(0);
|
||||
|
@ -79,17 +81,17 @@ public class LinkingErrorTest extends AbstractXtextTests {
|
|||
return getTreeIteratorContentSize(iterator);
|
||||
}
|
||||
|
||||
public void testReparse() throws Exception {
|
||||
@Test public void testReparse() throws Exception {
|
||||
String modelText = " type A extends B \n type B extends C";
|
||||
XtextResource resource = getResourceFromStringAndExpect(modelText, 1);
|
||||
EObject model = getModel(resource);
|
||||
|
||||
assertWithXtend("2", "types.size", model);
|
||||
Main model = (Main) getModel(resource);
|
||||
|
||||
assertEquals(2, model.getTypes().size());
|
||||
assertEquals(4, getContentSize(model));
|
||||
|
||||
resource.reparse(modelText);
|
||||
model = getModel(resource);
|
||||
assertWithXtend("2", "types.size", model);
|
||||
model = (Main) getModel(resource);
|
||||
assertEquals(2, model.getTypes().size());
|
||||
assertEquals(4, getContentSize(model));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,9 @@ package org.eclipse.xtext.linking;
|
|||
import org.eclipse.xtext.diagnostics.Diagnostic;
|
||||
import org.eclipse.xtext.diagnostics.DiagnosticMessage;
|
||||
import org.eclipse.xtext.diagnostics.Severity;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -29,7 +30,7 @@ public class LinkingWarningsTest extends AbstractXtextTests implements ILinkingD
|
|||
private final String expected = "Expected Message";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new LangATestLanguageStandaloneSetup() {
|
||||
@Override
|
||||
|
@ -48,13 +49,13 @@ public class LinkingWarningsTest extends AbstractXtextTests implements ILinkingD
|
|||
return new DiagnosticMessage(expected, Severity.WARNING, Diagnostic.LINKING_DIAGNOSTIC);
|
||||
}
|
||||
|
||||
public void testNoErrors() throws Exception {
|
||||
@Test public void testNoErrors() throws Exception {
|
||||
XtextResource resource = getResourceFromString(" type A extends B \n type B extends A");
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
assertTrue(resource.getWarnings().isEmpty());
|
||||
}
|
||||
|
||||
public void testLinkingProblemAsWarning() throws Exception {
|
||||
@Test public void testLinkingProblemAsWarning() throws Exception {
|
||||
String modelAsText = "type A extends B \n type B extends C";
|
||||
XtextResource resource = getResourceFromStringAndExpect(modelAsText, 0);
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
|
@ -65,7 +66,7 @@ public class LinkingWarningsTest extends AbstractXtextTests implements ILinkingD
|
|||
assertEquals(expected, warning.getMessage());
|
||||
}
|
||||
|
||||
public void testFixedLinkingProblem() throws Exception {
|
||||
@Test public void testFixedLinkingProblem() throws Exception {
|
||||
String modelAsText = "type A extends B \n type B extends C";
|
||||
XtextResource resource = getResourceFromStringAndExpect(modelAsText, 0);
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.eclipse.emf.common.util.EList;
|
|||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.impl.DefaultLinkingService;
|
||||
import org.eclipse.xtext.linking.impl.Linker;
|
||||
import org.eclipse.xtext.linking.impl.LinkingDiagnosticMessageProvider;
|
||||
|
@ -33,6 +33,7 @@ import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider;
|
|||
import org.eclipse.xtext.scoping.impl.LoadOnDemandResourceDescriptions;
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.util.IResourceScopeCache;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.inject.Provider;
|
||||
|
||||
|
@ -56,7 +57,7 @@ public class PartialLinkingTest extends AbstractXtextTests implements IScopeProv
|
|||
private EReference reference;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
|
||||
IQualifiedNameConverter nameConverter = new IQualifiedNameConverter.DefaultImpl();
|
||||
|
@ -115,7 +116,7 @@ public class PartialLinkingTest extends AbstractXtextTests implements IScopeProv
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPartialLinking() {
|
||||
@Test public void testPartialLinking() {
|
||||
int idx = modelAsText.indexOf("Bommel2 2");
|
||||
resource.update(idx + 1, 1, "o");
|
||||
EList<EObject> content = (EList<EObject>) context.eGet(reference);
|
||||
|
@ -123,7 +124,7 @@ public class PartialLinkingTest extends AbstractXtextTests implements IScopeProv
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPartialLinkingTwice() {
|
||||
@Test public void testPartialLinkingTwice() {
|
||||
int idx = modelAsText.indexOf("Bommel2 2");
|
||||
resource.update(idx + 1, 1, "o");
|
||||
resource.update(idx + 1, 1, "o");
|
||||
|
@ -132,7 +133,7 @@ public class PartialLinkingTest extends AbstractXtextTests implements IScopeProv
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPartialLinkingFakedScope() {
|
||||
@Test public void testPartialLinkingFakedScope() {
|
||||
replaceLinker(resource);
|
||||
assertTrue(resource.getErrors().isEmpty());
|
||||
int idx = modelAsText.indexOf("Bommel2 2");
|
||||
|
@ -145,7 +146,7 @@ public class PartialLinkingTest extends AbstractXtextTests implements IScopeProv
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLinking() {
|
||||
@Test public void testLinking() {
|
||||
EList<EObject> content = (EList<EObject>) context.eGet(reference);
|
||||
assertEquals(1, content.size());
|
||||
}
|
||||
|
|
|
@ -10,19 +10,20 @@ package org.eclipse.xtext.linking;
|
|||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.EFactory;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EcoreFactory;
|
||||
import org.eclipse.xtext.util.SimpleAttributeResolver;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public class SimpleAttributeResolverTest extends TestCase {
|
||||
public class SimpleAttributeResolverTest extends Assert {
|
||||
|
||||
private EcoreFactory factory;
|
||||
|
||||
|
@ -31,22 +32,21 @@ public class SimpleAttributeResolverTest extends TestCase {
|
|||
@SuppressWarnings("rawtypes")
|
||||
private SimpleAttributeResolver<EObject, EList> superClassResolver;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
factory = EcoreFactory.eINSTANCE;
|
||||
nameResolver = SimpleAttributeResolver.newResolver(String.class, "name");
|
||||
superClassResolver = SimpleAttributeResolver.newResolver(EList.class, "eSuperTypes");
|
||||
}
|
||||
|
||||
public void testGetNameValue() {
|
||||
@Test public void testGetNameValue() {
|
||||
EClass clazz = factory.createEClass();
|
||||
clazz.setName("ClassName");
|
||||
String name = nameResolver.getValue(clazz);
|
||||
assertEquals("ClassName", name);
|
||||
}
|
||||
|
||||
public void testGetNameValueTwice() {
|
||||
@Test public void testGetNameValueTwice() {
|
||||
EClass clazz = factory.createEClass();
|
||||
clazz.setName("ClassName");
|
||||
assertEquals(0, clazz.eAdapters().size());
|
||||
|
@ -58,13 +58,13 @@ public class SimpleAttributeResolverTest extends TestCase {
|
|||
assertEquals("ClassName2", name);
|
||||
}
|
||||
|
||||
public void testGetUnknownValue() {
|
||||
@Test public void testGetUnknownValue() {
|
||||
EFactory fact = factory.createEFactory();
|
||||
String name = nameResolver.getValue(fact);
|
||||
assertNull(name);
|
||||
}
|
||||
|
||||
public void testGetNameMatches() {
|
||||
@Test public void testGetNameMatches() {
|
||||
EClass clazzMatch = factory.createEClass();
|
||||
EClass clazzNoMatch = factory.createEClass();
|
||||
clazzMatch.setName("ClassName");
|
||||
|
@ -77,7 +77,7 @@ public class SimpleAttributeResolverTest extends TestCase {
|
|||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testGetListValue() {
|
||||
@Test public void testGetListValue() {
|
||||
EClass clazz = factory.createEClass();
|
||||
assertNotNull(clazz.getESuperTypes());
|
||||
EList<?> superTypes = superClassResolver.getValue(clazz);
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.emf.common.util.EList;
|
|||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.InternalEObject;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.lazy.lazyLinking.LazyLinkingPackage;
|
||||
import org.eclipse.xtext.linking.lazy.lazyLinking.Model;
|
||||
import org.eclipse.xtext.linking.lazy.lazyLinking.Property;
|
||||
|
@ -24,6 +24,7 @@ import org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty;
|
|||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -37,12 +38,12 @@ public class BasicLazyLinkingTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new LazyLinkingTestLanguageStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testLazyLinking() throws Exception {
|
||||
@Test public void testLazyLinking() throws Exception {
|
||||
XtextResource resource = getResource(new StringInputStream("type A extends B.id{} type B { A id; }"));
|
||||
doTest(resource);
|
||||
}
|
||||
|
@ -58,17 +59,17 @@ public class BasicLazyLinkingTest extends AbstractXtextTests {
|
|||
assertEquals(typeB.getProperties().get(0),parentId);
|
||||
}
|
||||
|
||||
public void testRecursion() throws Exception {
|
||||
@Test public void testRecursion() throws Exception {
|
||||
XtextResource resource = getResource(new StringInputStream("type A extends B.a { B b; } type B extends A.b { A a; }"));
|
||||
doTest(resource);
|
||||
}
|
||||
|
||||
public void testBackwardDependency() throws Exception {
|
||||
@Test public void testBackwardDependency() throws Exception {
|
||||
XtextResource resource = getResource(new StringInputStream("type A for a in B { B b; } type B for b in A { A a; }"));
|
||||
doTest(resource);
|
||||
}
|
||||
|
||||
public void testLazyMultiRef() throws Exception {
|
||||
@Test public void testLazyMultiRef() throws Exception {
|
||||
XtextResource resource = getResource(new StringInputStream("type A {} type B { A B a; }"));
|
||||
Model m = (Model) resource.getContents().get(0);
|
||||
Type t2 = m.getTypes().get(1);
|
||||
|
@ -81,7 +82,7 @@ public class BasicLazyLinkingTest extends AbstractXtextTests {
|
|||
assertFalse(((InternalEObject)types.get(1)).eIsProxy());
|
||||
}
|
||||
|
||||
public void testLazyMultiRefDuplicates() throws Exception {
|
||||
@Test public void testLazyMultiRefDuplicates() throws Exception {
|
||||
XtextResource resource = getResource(new StringInputStream("type A {} type B { A B A a; }"));
|
||||
Model m = (Model) resource.getContents().get(0);
|
||||
Type t1 = m.getTypes().get(0);
|
||||
|
@ -98,7 +99,7 @@ public class BasicLazyLinkingTest extends AbstractXtextTests {
|
|||
assertEquals(t1, types.get(2));
|
||||
}
|
||||
|
||||
public void testBug281775_01() throws Exception {
|
||||
@Test public void testBug281775_01() throws Exception {
|
||||
String model = "type A {\n" +
|
||||
" A B a;\n" +
|
||||
"}\n" +
|
||||
|
@ -123,7 +124,7 @@ public class BasicLazyLinkingTest extends AbstractXtextTests {
|
|||
assertEquals(t1, propB.getType().get(1));
|
||||
}
|
||||
|
||||
public void testBug281775_02() throws Exception {
|
||||
@Test public void testBug281775_02() throws Exception {
|
||||
String model = "type A {\n" +
|
||||
" unresolved A B a;\n" +
|
||||
"}\n" +
|
||||
|
@ -152,7 +153,7 @@ public class BasicLazyLinkingTest extends AbstractXtextTests {
|
|||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=282486
|
||||
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=303441
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testReferenceWithOpposite() throws Exception {
|
||||
@Test public void testReferenceWithOpposite() throws Exception {
|
||||
XtextResource resource = getResourceAndExpect(new StringInputStream("type foo {} type bar extends foo {}"), 1);
|
||||
Model model = (Model) resource.getContents().get(0);
|
||||
Type typeFoo = model.getTypes().get(0);
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
package org.eclipse.xtext.linking.lazy;
|
||||
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.lazy.lazyLinking.Type;
|
||||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -26,7 +27,7 @@ public class Bug281990Test extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new LazyLinkingTestLanguageRuntimeModule() {
|
||||
@Override
|
||||
|
@ -37,7 +38,7 @@ public class Bug281990Test extends AbstractXtextTests {
|
|||
new LazyLinkingTestLanguageStandaloneSetup().register(getInjector());
|
||||
}
|
||||
|
||||
public void testRecursionErrorMessage() throws Exception {
|
||||
@Test public void testRecursionErrorMessage() throws Exception {
|
||||
try {
|
||||
getModel("type Foo extends Foo.bar { Foo foo; }");
|
||||
fail("Exception expected.");
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.linking.lazy;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.Bug289059TestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.linking.bug289059Test.Model;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -17,18 +18,18 @@ import org.eclipse.xtext.linking.bug289059Test.Model;
|
|||
public class Bug289059Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(Bug289059TestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testModelLinked_01() throws Exception {
|
||||
@Test public void testModelLinked_01() throws Exception {
|
||||
String modelAsText = "model model";
|
||||
Model model = (Model) getModel(modelAsText);
|
||||
assertSame(model, model.getReference());
|
||||
}
|
||||
|
||||
public void testModelLinked_02() throws Exception {
|
||||
@Test public void testModelLinked_02() throws Exception {
|
||||
String modelAsText = "model enabled model";
|
||||
Model model = (Model) getModel(modelAsText);
|
||||
assertSame(model, model.getReference());
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.linking.lazy;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.lazy.bug311337.Model;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -16,12 +17,12 @@ import org.eclipse.xtext.linking.lazy.bug311337.Model;
|
|||
public class Bug311337Test extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new Bug311337TestLanguageStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testNoCyclicLinkingException() throws Exception {
|
||||
@Test public void testNoCyclicLinkingException() throws Exception {
|
||||
Model model = (Model) getModel(
|
||||
"/************************************/\n"+
|
||||
"(def) local :\n"+
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.eclipse.xtext.IGrammarAccess;
|
|||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.XtextFactory;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.LeafNode;
|
||||
|
@ -38,6 +38,7 @@ import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
|
|||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.resource.impl.ListBasedDiagnosticConsumer;
|
||||
import org.eclipse.xtext.util.Pair;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.inject.AbstractModule;
|
||||
|
@ -52,7 +53,7 @@ public class LazyLinkerTest extends AbstractXtextTests {
|
|||
private XtextResourceSet resourceSet;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new AbstractModule() {
|
||||
@Override
|
||||
|
@ -85,14 +86,14 @@ public class LazyLinkerTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
lazyLinkingPackage = null;
|
||||
linker = null;
|
||||
resourceSet = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testSingleValuedResolveProxiesReference() throws Exception {
|
||||
@Test public void testSingleValuedResolveProxiesReference() throws Exception {
|
||||
final EObject foo = newEObject("Foo");
|
||||
final EObject bar = newEObject("Bar");
|
||||
final Resource resource = new ResourceImpl(URI.createURI("http://foo/bar.ecore")) {
|
||||
|
@ -114,7 +115,7 @@ public class LazyLinkerTest extends AbstractXtextTests {
|
|||
assertEquals(bar, foo.eGet(eReference, false));
|
||||
}
|
||||
|
||||
public void testManyValuedResolveProxiesReference() throws Exception {
|
||||
@Test public void testManyValuedResolveProxiesReference() throws Exception {
|
||||
final EObject foo = newEObject("Foo");
|
||||
final List<EObject> bars = Lists.newArrayList(newEObject("Bar"), newEObject("Bar"));
|
||||
final Iterator<EObject> barsIterator = bars.iterator();
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.xtext.diagnostics.Severity;
|
|||
import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.index.indexTestLanguage.Entity;
|
||||
import org.eclipse.xtext.index.indexTestLanguage.IndexTestLanguagePackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.ILinkingService;
|
||||
import org.eclipse.xtext.linking.impl.IllegalNodeException;
|
||||
import org.eclipse.xtext.linking.impl.LinkingDiagnosticMessageProvider;
|
||||
|
@ -54,6 +54,7 @@ import org.eclipse.xtext.util.CancelIndicator;
|
|||
import org.eclipse.xtext.util.StringInputStream;
|
||||
import org.eclipse.xtext.util.Triple;
|
||||
import org.eclipse.xtext.util.Tuples;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -66,7 +67,7 @@ import com.google.inject.Injector;
|
|||
*/
|
||||
public class LazyLinkingResourceTest extends AbstractXtextTests {
|
||||
|
||||
public void testEObjectReference() throws Exception {
|
||||
@Test public void testEObjectReference() throws Exception {
|
||||
final EAnnotation source = EcoreFactory.eINSTANCE.createEAnnotation();
|
||||
final EObject referencedObject = XtextFactory.eINSTANCE.createGrammar();
|
||||
|
||||
|
@ -99,7 +100,7 @@ public class LazyLinkingResourceTest extends AbstractXtextTests {
|
|||
assertEquals(referencedObject, res.getEObject("foo"));
|
||||
}
|
||||
|
||||
public void testWarningInsteadOfError() throws Exception {
|
||||
@Test public void testWarningInsteadOfError() throws Exception {
|
||||
final EAnnotation source = EcoreFactory.eINSTANCE.createEAnnotation();
|
||||
LazyLinkingResource res = new LazyLinkingResource();
|
||||
res.setEncoder(new LazyURIEncoder() {
|
||||
|
@ -159,7 +160,7 @@ public class LazyLinkingResourceTest extends AbstractXtextTests {
|
|||
}
|
||||
};
|
||||
|
||||
public void testResolveLazyCrossReferences() throws Exception {
|
||||
@Test public void testResolveLazyCrossReferences() throws Exception {
|
||||
with(testLangaugeSetup());
|
||||
ResourceSetImpl rs = new ResourceSetImpl();
|
||||
final Resource res1 = rs.createResource(URI.createURI("file1.indextestlanguage"));
|
||||
|
@ -195,7 +196,7 @@ public class LazyLinkingResourceTest extends AbstractXtextTests {
|
|||
assertFalse(((EObject)e.getProperties().get(1).eGet(IndexTestLanguagePackage.Literals.PROPERTY__TYPE, false)).eIsProxy());
|
||||
}
|
||||
|
||||
public void testResolveLazyCrossReferences_01() throws Exception {
|
||||
@Test public void testResolveLazyCrossReferences_01() throws Exception {
|
||||
with(testLangaugeSetup());
|
||||
ResourceSetImpl rs = new ResourceSetImpl();
|
||||
final Resource res1 = rs.createResource(URI.createURI("file1.indextestlanguage"));
|
||||
|
@ -250,7 +251,7 @@ public class LazyLinkingResourceTest extends AbstractXtextTests {
|
|||
};
|
||||
}
|
||||
|
||||
public void testResolveLazyCrossReferences_02() throws Exception {
|
||||
@Test public void testResolveLazyCrossReferences_02() throws Exception {
|
||||
with(lazyLinkingTestLangaugeSetup());
|
||||
ResourceSetImpl rs = new ResourceSetImpl();
|
||||
final Resource res1 = rs.createResource(URI.createURI("file1.lazylinkingtestlanguage"));
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.xtext.resource.IEObjectDescription;
|
|||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
|
||||
import org.eclipse.xtext.scoping.impl.SimpleScope;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
|
|
|
@ -15,16 +15,18 @@ import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
|||
import org.eclipse.xtext.nodemodel.impl.CompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*
|
||||
*/
|
||||
public class LazyURIEncoderTest extends TestCase {
|
||||
public class LazyURIEncoderTest extends Assert {
|
||||
|
||||
public void testNodePath() throws Exception {
|
||||
@Test public void testNodePath() throws Exception {
|
||||
NodeModelBuilder builder = new NodeModelBuilder();
|
||||
ICompositeNode n = new CompositeNode();
|
||||
ICompositeNode n1 = new CompositeNode();
|
||||
|
@ -45,16 +47,14 @@ public class LazyURIEncoderTest extends TestCase {
|
|||
|
||||
private LazyURIEncoder encoder;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
encoder = new LazyURIEncoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
encoder = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private INode find(INode parent, INode toFind) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import static com.google.common.collect.Iterables.*;
|
|||
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.ImportUriTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.linking.importedURI.ImportedURIPackage;
|
||||
import org.eclipse.xtext.linking.importedURI.Main;
|
||||
|
@ -19,13 +19,14 @@ import org.eclipse.xtext.linking.importedURI.Type;
|
|||
import org.eclipse.xtext.resource.IEObjectDescription;
|
||||
import org.eclipse.xtext.scoping.IScope;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
*/
|
||||
public class URINormalizationTest extends AbstractXtextTests {
|
||||
|
||||
public void testGetElementByClasspathURIEObject() throws Exception {
|
||||
@Test public void testGetElementByClasspathURIEObject() throws Exception {
|
||||
with(ImportUriTestLanguageStandaloneSetup.class);
|
||||
Main main = (Main) getModel("import 'classpath:/org/eclipse/xtext/linking/05.importuritestlanguage'\n"
|
||||
+ "type Bar extends Foo");
|
||||
|
|
|
@ -73,6 +73,19 @@ ExtendsPluginEObject:
|
|||
)?
|
||||
;
|
||||
|
||||
Unused_01 returns ExtendsNsURIEObject:
|
||||
{MyNamedElement_01} name = ValidID
|
||||
;
|
||||
|
||||
Unused_02 returns ExtendsResourceEObject:
|
||||
{MyNamedElement_02} name = ValidID
|
||||
;
|
||||
|
||||
Unused_03 returns ExtendsPluginEObject:
|
||||
{MyNamedElement_03} name = ValidID
|
||||
;
|
||||
|
||||
|
||||
ExtendsResourceEObject:
|
||||
'ExtendsResourceEObject' name=ValidID
|
||||
(
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
package org.eclipse.xtext.metamodelreferencing.tests;
|
||||
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -17,12 +18,12 @@ import org.eclipse.xtext.resource.XtextResource;
|
|||
public class ExceptionTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testExceptionOnRegenerate() throws Exception {
|
||||
@Test public void testExceptionOnRegenerate() throws Exception {
|
||||
String model = "grammar org.eclipse.xtext.ExceptionTest with org.eclipse.xtext.common.Terminals\n" +
|
||||
"generate existing 'http://www.eclipse.org/xtext/tests/grammarinheritance'\n" +
|
||||
"import 'classpath:/org/eclipse/xtext/grammarinheritance/ametamodel.ecore' as existing\n" +
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.metamodelreferencing.tests;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MetamodelRefTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new MetamodelRefTestLanguageStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testStuff() throws Exception {
|
||||
Object parse = getModelAndExpect("foo bar", 1);
|
||||
assertWithXtend("'org::eclipse::xtext::metamodelreferencing::tests::anotherSimpleTest::impl::FooImpl'",
|
||||
"metaType.name", parse);
|
||||
assertWithXtend("'org::eclipse::xtext::impl::RuleCallImpl'", "nameRefs.first().metaType.name", parse);
|
||||
@Test public void testStuff() throws Exception {
|
||||
Foo parse = (Foo) getModelAndExpect("foo bar", 1);
|
||||
assertEquals(1, parse.getNameRefs().size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,24 +8,24 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.metamodelreferencing.tests;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.simpleTest.Foo;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MultiGenMMTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new XtextStandaloneSetup());
|
||||
|
||||
with(new MultiGenMMTestLanguageStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testStuff() throws Exception {
|
||||
EObject parse = getModel("foo 'bar'");
|
||||
assertWithXtend("'org::eclipse::xtext::metamodelreferencing::tests::simpleTest::impl::FooImpl'", "metaType.name", parse);
|
||||
assertWithXtend("'org::eclipse::xtext::metamodelreferencing::tests::otherTest::impl::FooBarImpl'", "nameRefs.first().metaType.name", parse);
|
||||
@Test public void testStuff() throws Exception {
|
||||
Foo parse = (Foo) getModel("foo 'bar'");
|
||||
assertEquals(1, parse.getNameRefs().size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
|
|||
import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.index.indexTestLanguage.Entity;
|
||||
import org.eclipse.xtext.index.indexTestLanguage.IndexTestLanguagePackage;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
|
@ -34,7 +35,7 @@ import com.google.common.base.Predicate;
|
|||
*/
|
||||
public abstract class AbstractReaderTest extends AbstractXtextTests {
|
||||
|
||||
public void testLoadMatchNone() throws Exception {
|
||||
@Test public void testLoadMatchNone() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -56,7 +57,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
assertTrue(slotContent.isEmpty());
|
||||
}
|
||||
|
||||
public void testLoadMatchAll() throws Exception {
|
||||
@Test public void testLoadMatchAll() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -86,7 +87,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadByType() throws Exception {
|
||||
@Test public void testLoadByType() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -102,7 +103,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadBySuperType() throws Exception {
|
||||
@Test public void testLoadBySuperType() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -117,7 +118,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
assertEquals(3, entities.size());
|
||||
}
|
||||
|
||||
public void testLoadByType_FirstOnly() throws Exception {
|
||||
@Test public void testLoadByType_FirstOnly() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -133,7 +134,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadByType_withNsURI() throws Exception {
|
||||
@Test public void testLoadByType_withNsURI() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -149,7 +150,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
assertEquals(2, entities.size());
|
||||
}
|
||||
|
||||
public void testLoadByType_withUnkownNsURI() throws Exception {
|
||||
@Test public void testLoadByType_withUnkownNsURI() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -178,7 +179,7 @@ public abstract class AbstractReaderTest extends AbstractXtextTests {
|
|||
};
|
||||
}
|
||||
|
||||
public void testParseClassPath() throws Exception {
|
||||
@Test public void testParseClassPath() throws Exception {
|
||||
Reader reader = getReader();
|
||||
assertEquals(0, reader.getPathes().size());
|
||||
reader.setUseJavaClassPath(true);
|
||||
|
|
|
@ -8,19 +8,19 @@
|
|||
package org.eclipse.xtext.mwe;
|
||||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public class NameBasedFilterTest extends TestCase {
|
||||
public class NameBasedFilterTest extends Assert {
|
||||
|
||||
public void testNullUri() {
|
||||
@Test public void testNullUri() {
|
||||
assertFalse(new NameBasedFilter().matches(null));
|
||||
}
|
||||
|
||||
public void testByFileExtension() {
|
||||
@Test public void testByFileExtension() {
|
||||
NameBasedFilter filter = new NameBasedFilter();
|
||||
filter.setExtension("foo");
|
||||
URI match = URI.createFileURI("path/to/myFile.foo");
|
||||
|
@ -29,7 +29,7 @@ public class NameBasedFilterTest extends TestCase {
|
|||
assertFalse(filter.matches(mismatch));
|
||||
}
|
||||
|
||||
public void testNoCriteria() {
|
||||
@Test public void testNoCriteria() {
|
||||
NameBasedFilter filter = new NameBasedFilter();
|
||||
URI match = URI.createFileURI("path/to/myFile.foo");
|
||||
assertTrue(filter.matches(match));
|
||||
|
@ -37,7 +37,7 @@ public class NameBasedFilterTest extends TestCase {
|
|||
assertTrue(filter.matches(match));
|
||||
}
|
||||
|
||||
public void testByRegularExpression() {
|
||||
@Test public void testByRegularExpression() {
|
||||
NameBasedFilter filter = new NameBasedFilter();
|
||||
filter.setRegularExpression("ile\\.fo");
|
||||
URI match = URI.createFileURI("path/to/myFile.foo");
|
||||
|
@ -46,7 +46,7 @@ public class NameBasedFilterTest extends TestCase {
|
|||
assertFalse(filter.matches(mismatch));
|
||||
}
|
||||
|
||||
public void testByExtensionAndRegExpr() {
|
||||
@Test public void testByExtensionAndRegExpr() {
|
||||
NameBasedFilter filter = new NameBasedFilter();
|
||||
filter.setRegularExpression("ath");
|
||||
filter.setExtension("foo");
|
||||
|
|
|
@ -9,16 +9,16 @@ package org.eclipse.xtext.mwe;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
*/
|
||||
public class PathTraverserTest extends TestCase {
|
||||
public class PathTraverserTest extends Assert {
|
||||
public static Predicate<URI> everythingButDummy = new Predicate<URI>() {
|
||||
|
||||
public boolean apply(URI input) {
|
||||
|
@ -26,19 +26,19 @@ public class PathTraverserTest extends TestCase {
|
|||
}
|
||||
};
|
||||
|
||||
public void testEmptyFolder() throws Exception {
|
||||
@Test public void testEmptyFolder() throws Exception {
|
||||
String path = pathTo("emptyFolder");
|
||||
Set<URI> uris = new PathTraverser().findAllResourceUris(path, everythingButDummy);
|
||||
assertTrue(uris.isEmpty());
|
||||
}
|
||||
|
||||
public void testNonEmptyFolder() throws Exception {
|
||||
@Test public void testNonEmptyFolder() throws Exception {
|
||||
String path = pathTo("nonemptyFolder");
|
||||
Set<URI> uris = new PathTraverser().findAllResourceUris(path, everythingButDummy);
|
||||
assertEquals(2,uris.size());
|
||||
}
|
||||
|
||||
public void testArchive() throws Exception {
|
||||
@Test public void testArchive() throws Exception {
|
||||
String path = pathTo("nonemptyJar.jar");
|
||||
Set<URI> uris = new PathTraverser().findAllResourceUris(path, everythingButDummy);
|
||||
assertEquals(3,uris.size());
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.emf.mwe.core.issues.Issues;
|
|||
import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.index.indexTestLanguage.Datatype;
|
||||
import org.eclipse.xtext.index.indexTestLanguage.Entity;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
|
@ -28,7 +29,7 @@ public class ReaderTest extends AbstractReaderTest {
|
|||
return new SlotEntry();
|
||||
}
|
||||
|
||||
public void testLoadOne() throws Exception {
|
||||
@Test public void testLoadOne() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -45,7 +46,7 @@ public class ReaderTest extends AbstractReaderTest {
|
|||
assertEquals("Person", ((Entity) ctx.get("model")).getName());
|
||||
}
|
||||
|
||||
public void testLoadTwo() throws Exception {
|
||||
@Test public void testLoadTwo() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -75,7 +76,7 @@ public class ReaderTest extends AbstractReaderTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadAll() throws Exception {
|
||||
@Test public void testLoadAll() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -90,7 +91,7 @@ public class ReaderTest extends AbstractReaderTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testShadowingPathes() throws Exception {
|
||||
@Test public void testShadowingPathes() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("shadowingtest/folder 1"));
|
||||
reader.addPath(pathTo("shadowingtest/folder 2"));
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.mwe.core.WorkflowContext;
|
||||
import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
|
@ -24,7 +25,7 @@ public class ResourceSetBasedSlotEntryReaderTest extends AbstractReaderTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadAll() throws Exception {
|
||||
@Test public void testLoadAll() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
@ -39,7 +40,7 @@ public class ResourceSetBasedSlotEntryReaderTest extends AbstractReaderTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadFileElements() throws Exception {
|
||||
@Test public void testLoadFileElements() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("emptyFolder"));
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
|
|
|
@ -19,11 +19,12 @@ import org.eclipse.xtext.Constants;
|
|||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.XtextPackage;
|
||||
import org.eclipse.xtext.XtextStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.linking.ImportUriTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.linking.importedURI.Type;
|
||||
import org.eclipse.xtext.resource.IResourceFactory;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Guice;
|
||||
|
@ -60,7 +61,7 @@ public class UriBasedReaderTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testTransitiveReferences() throws Exception {
|
||||
@Test public void testTransitiveReferences() throws Exception {
|
||||
UriBasedReader reader = new UriBasedReader();
|
||||
reader.addRegister(new ImportUriTestLanguageStandaloneSetup());
|
||||
reader.addUri("file:" + pathTo("importUriSubfolder/Start.importuritestlanguage"));
|
||||
|
@ -92,7 +93,7 @@ public class UriBasedReaderTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
@Test public void testSimple() throws Exception {
|
||||
UriBasedReader reader = new UriBasedReader() {
|
||||
{
|
||||
getValidator().setStopOnError(false);
|
||||
|
@ -115,7 +116,7 @@ public class UriBasedReaderTest extends AbstractXtextTests {
|
|||
assertEquals(issues.toString(), 1, issues.getErrors().length);
|
||||
}
|
||||
|
||||
public void testMissingRegistration() throws Exception {
|
||||
@Test public void testMissingRegistration() throws Exception {
|
||||
with(new XtextErrorStandaloneSetup());
|
||||
UriBasedReader reader = new UriBasedReader();
|
||||
reader.setClasspathURIContext(getClass());
|
||||
|
@ -126,7 +127,7 @@ public class UriBasedReaderTest extends AbstractXtextTests {
|
|||
assertTrue(issues.hasErrors());
|
||||
}
|
||||
|
||||
public void testMissingUri() throws Exception {
|
||||
@Test public void testMissingUri() throws Exception {
|
||||
UriBasedReader reader = new UriBasedReader();
|
||||
reader.setClasspathURIContext(getClass());
|
||||
reader.addRegister(new XtextStandaloneSetup());
|
||||
|
@ -136,7 +137,7 @@ public class UriBasedReaderTest extends AbstractXtextTests {
|
|||
assertTrue(issues.hasErrors());
|
||||
}
|
||||
|
||||
public void testIssuesInOtherResource() throws Exception {
|
||||
@Test public void testIssuesInOtherResource() throws Exception {
|
||||
UriBasedReader reader = new UriBasedReader() {
|
||||
{
|
||||
getValidator().setStopOnError(false);
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.eclipse.emf.mwe.core.WorkflowContext;
|
|||
import org.eclipse.emf.mwe.core.issues.Issues;
|
||||
import org.eclipse.emf.mwe.core.issues.MWEDiagnostic;
|
||||
import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Michael Clay - Initial contribution and API
|
||||
|
@ -35,7 +36,7 @@ public class ValidatorTest extends AbstractReaderTest {
|
|||
/**
|
||||
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=322645
|
||||
*/
|
||||
public void testBugFix322645() throws Exception {
|
||||
@Test public void testBugFix322645() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("nonemptyFolder"));
|
||||
reader.addRegister(new IndexTestLanguageStandaloneSetup());
|
||||
|
|
|
@ -7,14 +7,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.naming;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
*/
|
||||
public class DeclarativeQualifiedNameConverterTest extends TestCase {
|
||||
public class DeclarativeQualifiedNameConverterTest extends Assert {
|
||||
|
||||
public void testQualifiedNameConverter() throws Exception {
|
||||
@Test public void testQualifiedNameConverter() throws Exception {
|
||||
IQualifiedNameConverter qualifiedNameConverter = new IQualifiedNameConverter.DefaultImpl() {
|
||||
@Override
|
||||
public String getDelimiter() {
|
||||
|
|
|
@ -7,16 +7,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.naming;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
*/
|
||||
public class QualifiedNameTest extends TestCase {
|
||||
public class QualifiedNameTest extends Assert {
|
||||
|
||||
public void testCreateNull() {
|
||||
@Test public void testCreateNull() {
|
||||
assertEquals(QualifiedName.EMPTY, QualifiedName.create());
|
||||
assertEquals(QualifiedName.EMPTY, QualifiedName.create(new String[0]));
|
||||
assertEquals(QualifiedName.EMPTY, QualifiedName.create((String[]) null));
|
||||
|
@ -26,7 +27,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
} catch(IllegalArgumentException e) {}
|
||||
}
|
||||
|
||||
public void testSegments() {
|
||||
@Test public void testSegments() {
|
||||
QualifiedName qn = QualifiedName.create("foo", "bar", "baz");
|
||||
assertEquals(3, qn.getSegmentCount());
|
||||
assertEquals("foo", qn.getSegment(0));
|
||||
|
@ -36,7 +37,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
assertEquals("baz", qn.getLastSegment());
|
||||
}
|
||||
|
||||
public void testStartsWith() {
|
||||
@Test public void testStartsWith() {
|
||||
QualifiedName qn = QualifiedName.create("foo", "bar", "baz");
|
||||
QualifiedName qn1 = QualifiedName.create("foo", "bar");
|
||||
assertTrue(qn.startsWith(qn1));
|
||||
|
@ -50,7 +51,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
assertFalse(qn2.startsWithIgnoreCase(qn));
|
||||
}
|
||||
|
||||
public void testSkip() throws Exception {
|
||||
@Test public void testSkip() throws Exception {
|
||||
QualifiedName qn = QualifiedName.create("foo", "bar", "baz");
|
||||
QualifiedName baz = qn.skipFirst(2);
|
||||
assertEquals(1, baz.getSegmentCount());
|
||||
|
@ -79,7 +80,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
} catch(IllegalArgumentException e) {}
|
||||
}
|
||||
|
||||
public void testAppend() {
|
||||
@Test public void testAppend() {
|
||||
QualifiedName qn = QualifiedName.create("foo");
|
||||
QualifiedName fooBar = qn.append("bar");
|
||||
assertEquals(2, fooBar.getSegmentCount());
|
||||
|
@ -94,7 +95,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
assertEquals("bar", fooBarFooBar.getSegment(3));
|
||||
}
|
||||
|
||||
public void testEquals() {
|
||||
@Test public void testEquals() {
|
||||
QualifiedName qn = QualifiedName.create("foo", "bar");
|
||||
assertEquals(qn, qn);
|
||||
assertNotSame(qn, qn.skipFirst(1));
|
||||
|
@ -109,7 +110,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
}
|
||||
|
||||
|
||||
public void testCompare() throws Exception {
|
||||
@Test public void testCompare() throws Exception {
|
||||
QualifiedName a = QualifiedName.create("a");
|
||||
QualifiedName b = QualifiedName.create("b");
|
||||
assertTrue(a.compareTo(b) < 0);
|
||||
|
@ -137,12 +138,12 @@ public class QualifiedNameTest extends TestCase {
|
|||
assertEquals(0, aa.compareToIgnoreCase(aA));
|
||||
}
|
||||
|
||||
public void testToString() throws Exception {
|
||||
@Test public void testToString() throws Exception {
|
||||
QualifiedName qn = QualifiedName.create("foo", "bar");
|
||||
assertEquals("foo.bar", qn.toString());
|
||||
}
|
||||
|
||||
public void testToCase() throws Exception {
|
||||
@Test public void testToCase() throws Exception {
|
||||
QualifiedName qn = QualifiedName.create("foo", "bar");
|
||||
QualifiedName qnUpper = qn.toUpperCase();
|
||||
assertFalse(qnUpper.equals(qn));
|
||||
|
@ -152,7 +153,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
assertEquals(qn.toString(), qnUpper.toLowerCase().toString());
|
||||
}
|
||||
|
||||
public void testEmpty() {
|
||||
@Test public void testEmpty() {
|
||||
assertEquals(0, QualifiedName.EMPTY.getSegmentCount());
|
||||
assertTrue(QualifiedName.EMPTY.getSegments().isEmpty());
|
||||
try {
|
||||
|
@ -166,7 +167,7 @@ public class QualifiedNameTest extends TestCase {
|
|||
assertEquals("foo", foo.getLastSegment());
|
||||
}
|
||||
|
||||
public void testWrapper() throws Exception {
|
||||
@Test public void testWrapper() throws Exception {
|
||||
Function<String, String> identity = new Function<String, String>() {
|
||||
public String apply(String from) {
|
||||
return from;
|
||||
|
|
|
@ -7,18 +7,20 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.nodemodel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.emf.common.notify.Adapter;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EcoreFactory;
|
||||
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public abstract class AbstractCompositeNodeTest extends TestCase {
|
||||
public abstract class AbstractCompositeNodeTest extends Assert {
|
||||
|
||||
private NodeModelBuilder mutator;
|
||||
|
||||
|
@ -32,19 +34,17 @@ public abstract class AbstractCompositeNodeTest extends TestCase {
|
|||
mutator.addChild(composite, leaf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
this.mutator = new NodeModelBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
this.mutator = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testAddChild_00() {
|
||||
@Test public void testAddChild_00() {
|
||||
ICompositeNode composite = createCompositeNode();
|
||||
LeafNode first = new LeafNode();
|
||||
addChild(composite, first);
|
||||
|
@ -54,7 +54,7 @@ public abstract class AbstractCompositeNodeTest extends TestCase {
|
|||
assertSame(first, first.basicGetPreviousSibling());
|
||||
}
|
||||
|
||||
public void testAddChild_01() {
|
||||
@Test public void testAddChild_01() {
|
||||
ICompositeNode composite = createCompositeNode();
|
||||
LeafNode first = new LeafNode();
|
||||
LeafNode second = new LeafNode();
|
||||
|
@ -69,7 +69,7 @@ public abstract class AbstractCompositeNodeTest extends TestCase {
|
|||
assertSame(composite, second.getParent());
|
||||
}
|
||||
|
||||
public void testAddChild_02() {
|
||||
@Test public void testAddChild_02() {
|
||||
ICompositeNode composite = createCompositeNode();
|
||||
LeafNode first = new LeafNode();
|
||||
LeafNode second = new LeafNode();
|
||||
|
@ -89,7 +89,7 @@ public abstract class AbstractCompositeNodeTest extends TestCase {
|
|||
assertSame(composite, third.getParent());
|
||||
}
|
||||
|
||||
public void testActsAsAdapter() {
|
||||
@Test public void testActsAsAdapter() {
|
||||
EObject object = EcoreFactory.eINSTANCE.createEObject();
|
||||
ICompositeNode composite = createCompositeNode();
|
||||
object.eAdapters().add((Adapter) composite);
|
||||
|
|
|
@ -11,50 +11,50 @@ import java.util.NoSuchElementException;
|
|||
|
||||
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public abstract class AbstractNodeTest extends TestCase {
|
||||
public abstract class AbstractNodeTest extends Assert {
|
||||
|
||||
protected NodeModelBuilder builder;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
builder = new NodeModelBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
builder = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
protected abstract AbstractNode createNode();
|
||||
|
||||
public void testGetParent() {
|
||||
@Test public void testGetParent() {
|
||||
AbstractNode node = createNode();
|
||||
ICompositeNode parent = builder.newRootNode("input");
|
||||
builder.addChild(parent, node);
|
||||
assertSame(parent, node.getParent());
|
||||
}
|
||||
|
||||
public void testGetParent_NoParent() {
|
||||
@Test public void testGetParent_NoParent() {
|
||||
AbstractNode node = createNode();
|
||||
assertNull(node.getParent());
|
||||
}
|
||||
|
||||
public void testGetRootNode() {
|
||||
@Test public void testGetRootNode() {
|
||||
AbstractNode node = createNode();
|
||||
ICompositeNode rootNode = builder.newRootNode("My input");
|
||||
builder.addChild(rootNode, node);
|
||||
assertSame(rootNode, node.getRootNode());
|
||||
}
|
||||
|
||||
public void testGetRootNode_Parent() {
|
||||
@Test public void testGetRootNode_Parent() {
|
||||
AbstractNode node = createNode();
|
||||
ICompositeNode rootNode = builder.newRootNode("My input");
|
||||
ICompositeNode parent = builder.newCompositeNode(null, 0, rootNode);
|
||||
|
@ -62,19 +62,19 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertSame(rootNode, node.getRootNode());
|
||||
}
|
||||
|
||||
public void testGetRootNode_NoParent() {
|
||||
@Test public void testGetRootNode_NoParent() {
|
||||
AbstractNode node = createNode();
|
||||
assertNull(node.getRootNode());
|
||||
}
|
||||
|
||||
public void testGetRootNode_NoRoot() {
|
||||
@Test public void testGetRootNode_NoRoot() {
|
||||
AbstractNode node = createNode();
|
||||
ICompositeNode parent = new CompositeNode();
|
||||
builder.addChild(parent, node);
|
||||
assertNull(node.getRootNode());
|
||||
}
|
||||
|
||||
public void testIterator_Next() {
|
||||
@Test public void testIterator_Next() {
|
||||
AbstractNode node = createNode();
|
||||
BidiIterator<INode> iterator = node.iterator();
|
||||
assertTrue(iterator.hasNext());
|
||||
|
@ -88,7 +88,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testIterator_Previous() {
|
||||
@Test public void testIterator_Previous() {
|
||||
AbstractNode node = createNode();
|
||||
BidiIterator<INode> iterator = node.iterator();
|
||||
assertTrue(iterator.hasPrevious());
|
||||
|
@ -102,7 +102,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testIterator_Bidi() {
|
||||
@Test public void testIterator_Bidi() {
|
||||
AbstractNode node = createNode();
|
||||
BidiIterator<INode> iterator = node.iterator();
|
||||
assertSame(node, iterator.next());
|
||||
|
@ -111,7 +111,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertTrue(iterator.hasNext());
|
||||
}
|
||||
|
||||
public void testTreeIterator_Next() {
|
||||
@Test public void testTreeIterator_Next() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode node = createNode();
|
||||
builder.addChild(rootNode, node);
|
||||
|
@ -127,7 +127,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testTreeIterator_Next_NoParent() {
|
||||
@Test public void testTreeIterator_Next_NoParent() {
|
||||
AbstractNode node = createNode();
|
||||
BidiIterator<INode> iterator = node.iterator();
|
||||
assertTrue(iterator.hasNext());
|
||||
|
@ -141,7 +141,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testTreeIterator_Previous() {
|
||||
@Test public void testTreeIterator_Previous() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode node = createNode();
|
||||
builder.addChild(rootNode, node);
|
||||
|
@ -157,7 +157,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testTreeIterator_Previous_NoParent() {
|
||||
@Test public void testTreeIterator_Previous_NoParent() {
|
||||
AbstractNode node = createNode();
|
||||
BidiIterator<INode> iterator = node.iterator();
|
||||
assertTrue(iterator.hasPrevious());
|
||||
|
@ -171,7 +171,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testTreeIterator_Bidi() {
|
||||
@Test public void testTreeIterator_Bidi() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode node = createNode();
|
||||
builder.addChild(rootNode, node);
|
||||
|
@ -182,7 +182,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertTrue(iterator.hasNext());
|
||||
}
|
||||
|
||||
public void testTreeIterator_Bidi_NoParent() {
|
||||
@Test public void testTreeIterator_Bidi_NoParent() {
|
||||
AbstractNode node = createNode();
|
||||
BidiIterator<INode> iterator = node.iterator();
|
||||
assertSame(node, iterator.next());
|
||||
|
@ -193,7 +193,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
|
||||
public abstract void testGetText_Default();
|
||||
|
||||
public void testGetText_NoParent() {
|
||||
@Test public void testGetText_NoParent() {
|
||||
AbstractNode node = createNode();
|
||||
assertNull(node.getText());
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
|
||||
public abstract void testGetSemanticElement();
|
||||
|
||||
public void testGetNextSibling_SingleChild() {
|
||||
@Test public void testGetNextSibling_SingleChild() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode node = createNode();
|
||||
builder.addChild(rootNode, node);
|
||||
|
@ -220,7 +220,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertNull(node.getNextSibling());
|
||||
}
|
||||
|
||||
public void testGetNextSibling_FirstChild() {
|
||||
@Test public void testGetNextSibling_FirstChild() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode first = createNode();
|
||||
AbstractNode second = createNode();
|
||||
|
@ -230,7 +230,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertSame(second, first.getNextSibling());
|
||||
}
|
||||
|
||||
public void testGetNextSibling_LastChild() {
|
||||
@Test public void testGetNextSibling_LastChild() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode first = createNode();
|
||||
AbstractNode second = createNode();
|
||||
|
@ -240,7 +240,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertNull(second.getNextSibling());
|
||||
}
|
||||
|
||||
public void testGetPreviousSibling_SingleChild() {
|
||||
@Test public void testGetPreviousSibling_SingleChild() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode node = createNode();
|
||||
builder.addChild(rootNode, node);
|
||||
|
@ -249,7 +249,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertFalse(node.hasSiblings());
|
||||
}
|
||||
|
||||
public void testGetPreviousSibling_FirstChild() {
|
||||
@Test public void testGetPreviousSibling_FirstChild() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode first = createNode();
|
||||
AbstractNode second = createNode();
|
||||
|
@ -260,7 +260,7 @@ public abstract class AbstractNodeTest extends TestCase {
|
|||
assertTrue(first.hasSiblings());
|
||||
}
|
||||
|
||||
public void testGetPreviousSibling_LastChild() {
|
||||
@Test public void testGetPreviousSibling_LastChild() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
AbstractNode first = createNode();
|
||||
AbstractNode second = createNode();
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.emf.ecore.EObject;
|
|||
import org.eclipse.emf.ecore.EcoreFactory;
|
||||
import org.eclipse.emf.ecore.util.EcoreAdapterFactory;
|
||||
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -25,7 +26,7 @@ import com.google.common.collect.Iterables;
|
|||
public class CompositeNodeTest extends AbstractCompositeNodeTest {
|
||||
|
||||
@Override
|
||||
public void testTextOffsetLength() {
|
||||
@Test public void testTextOffsetLength() {
|
||||
RootNode root = new RootNode();
|
||||
String completeContent = " completeContent ";
|
||||
root.basicSetCompleteContent(completeContent);
|
||||
|
@ -48,7 +49,7 @@ public class CompositeNodeTest extends AbstractCompositeNodeTest {
|
|||
assertEquals(completeContent.trim().length(), composite.getTotalLength());
|
||||
}
|
||||
|
||||
public void testGetTotalOffsetWithoutChildren() {
|
||||
@Test public void testGetTotalOffsetWithoutChildren() {
|
||||
RootNode rootNode = new RootNode();
|
||||
rootNode.basicSetCompleteContent("my string");
|
||||
LeafNode leafNode = new LeafNode();
|
||||
|
@ -84,7 +85,7 @@ public class CompositeNodeTest extends AbstractCompositeNodeTest {
|
|||
assertEquals(3, thirdGrandChild.getOffset());
|
||||
}
|
||||
|
||||
public void testGetLeafNodes_01() {
|
||||
@Test public void testGetLeafNodes_01() {
|
||||
RootNode rootNode = new RootNode();
|
||||
rootNode.basicSetCompleteContent("my string");
|
||||
CompositeNode first = new CompositeNode();
|
||||
|
@ -134,7 +135,7 @@ public class CompositeNodeTest extends AbstractCompositeNodeTest {
|
|||
return new CompositeNodeWithSemanticElement();
|
||||
}
|
||||
|
||||
public void testIsAdapterForType() {
|
||||
@Test public void testIsAdapterForType() {
|
||||
EObject object = EcoreFactory.eINSTANCE.createEObject();
|
||||
CompositeNodeWithSemanticElement node = createCompositeNode();
|
||||
object.eAdapters().add(node);
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.eclipse.xtext.nodemodel;
|
|||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EcoreFactory;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -21,42 +22,42 @@ public class LeafNodeTest extends AbstractNodeTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void testGetText_Default() {
|
||||
@Test public void testGetText_Default() {
|
||||
ICompositeNode rootNode = builder.newRootNode("my input!");
|
||||
ILeafNode leafNode = builder.newLeafNode(3, 5, null, false, null, rootNode);
|
||||
assertEquals("input", leafNode.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testGetText_Empty() {
|
||||
@Test public void testGetText_Empty() {
|
||||
ICompositeNode rootNode = builder.newRootNode("my input");
|
||||
ILeafNode leafNode = builder.newLeafNode(0, 0, null, false, null, rootNode);
|
||||
assertEquals("", leafNode.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testTotalOffset() {
|
||||
@Test public void testTotalOffset() {
|
||||
ICompositeNode rootNode = builder.newRootNode("my input");
|
||||
ILeafNode leafNode = builder.newLeafNode(3, 5, null, false, null, rootNode);
|
||||
assertEquals(3, leafNode.getTotalOffset());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testTotalEndOffset() {
|
||||
@Test public void testTotalEndOffset() {
|
||||
ICompositeNode rootNode = builder.newRootNode("my input");
|
||||
ILeafNode leafNode = builder.newLeafNode(3, 5, null, false, null, rootNode);
|
||||
assertEquals(8, leafNode.getTotalEndOffset());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testTotalLength() {
|
||||
@Test public void testTotalLength() {
|
||||
ICompositeNode rootNode = builder.newRootNode("my input");
|
||||
ILeafNode leafNode = builder.newLeafNode(3, 5, null, false, null, rootNode);
|
||||
assertEquals(5, leafNode.getTotalLength());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testGetGrammarElement() {
|
||||
@Test public void testGetGrammarElement() {
|
||||
LeafNode leafNode = createNode();
|
||||
EObject grammarElement = EcoreFactory.eINSTANCE.createEObject();
|
||||
leafNode.basicSetGrammarElement(grammarElement);
|
||||
|
@ -64,7 +65,7 @@ public class LeafNodeTest extends AbstractNodeTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void testGetSyntaxErrorMessage() {
|
||||
@Test public void testGetSyntaxErrorMessage() {
|
||||
LeafNode leafNode = createNode();
|
||||
SyntaxErrorMessage errorMessage = new SyntaxErrorMessage("message", null);
|
||||
leafNode.basicSetSyntaxErrorMessage(errorMessage);
|
||||
|
@ -72,7 +73,7 @@ public class LeafNodeTest extends AbstractNodeTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void testGetSemanticElement() {
|
||||
@Test public void testGetSemanticElement() {
|
||||
ICompositeNode rootNode = builder.newRootNode("input");
|
||||
ICompositeNode parent = builder.newCompositeNode(null, 0, rootNode);
|
||||
EObject semanticElement = EcoreFactory.eINSTANCE.createEObject();
|
||||
|
|
|
@ -11,14 +11,12 @@ package org.eclipse.xtext.nodemodel;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.xtext.dummy.DummyTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LengthOffsetLineTest extends AbstractXtextTests {
|
||||
|
||||
public void testOffset() throws Exception {
|
||||
@Test public void testOffset() throws Exception {
|
||||
String model = "element foo;\nelement bar;";
|
||||
ICompositeNode node = getRootNode(model);
|
||||
Iterator<ILeafNode> iter = node.getLeafNodes().iterator();
|
||||
|
@ -33,7 +31,7 @@ public class LengthOffsetLineTest extends AbstractXtextTests {
|
|||
assertEquals(24,iter.next().getTotalOffset());
|
||||
}
|
||||
|
||||
public void testOffset2() throws Exception {
|
||||
@Test public void testOffset2() throws Exception {
|
||||
String model = "element foo;\nelement bar;";
|
||||
ICompositeNode node = getRootNode(model);
|
||||
Iterator<INode> iter = node.getChildren().iterator();
|
||||
|
@ -42,7 +40,7 @@ public class LengthOffsetLineTest extends AbstractXtextTests {
|
|||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testLineForLeafnodes() throws Exception {
|
||||
@Test public void testLineForLeafnodes() throws Exception {
|
||||
String model = "element foo;\nelement bar;";
|
||||
ICompositeNode node = getRootNode(model);
|
||||
Iterator<ILeafNode> iter = node.getLeafNodes().iterator();
|
||||
|
@ -58,7 +56,7 @@ public class LengthOffsetLineTest extends AbstractXtextTests {
|
|||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testLineForCompositeNodes() throws Exception {
|
||||
@Test public void testLineForCompositeNodes() throws Exception {
|
||||
String model = "element foo;\nelement bar;\nelement bar;\nelement bar;";
|
||||
ICompositeNode node = getRootNode(model);
|
||||
Iterator<INode> iter = node.getChildren().iterator();
|
||||
|
@ -72,7 +70,7 @@ public class LengthOffsetLineTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
|
||||
public void testErrors1() throws Exception {
|
||||
@Test public void testErrors1() throws Exception {
|
||||
String model = "element # ;";
|
||||
ICompositeNode node = getRootNodeAndExpect(model, 1);
|
||||
assertEquals(model, node.getText());
|
||||
|
@ -89,7 +87,7 @@ public class LengthOffsetLineTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(DummyTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.nodemodel;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -28,7 +28,7 @@ public class NodeModelStateTest extends AbstractXtextTests {
|
|||
private String model;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
|
||||
model = "// comment before root\n" +
|
||||
|
@ -46,131 +46,131 @@ public class NodeModelStateTest extends AbstractXtextTests {
|
|||
kindNode = kindLeaf.getParent();
|
||||
}
|
||||
|
||||
public void testRootGetOffset() {
|
||||
@Test public void testRootGetOffset() {
|
||||
assertEquals(model.indexOf("spielplatz"), rootNode.getOffset());
|
||||
}
|
||||
|
||||
public void testRootGetTotalOffset() {
|
||||
@Test public void testRootGetTotalOffset() {
|
||||
assertEquals(0, rootNode.getTotalOffset());
|
||||
}
|
||||
|
||||
public void testRootGetLength() {
|
||||
@Test public void testRootGetLength() {
|
||||
assertEquals(model.indexOf('}') - model.indexOf("spielplatz") + 1, rootNode.getLength());
|
||||
}
|
||||
|
||||
public void testRootGetTotalLength() {
|
||||
@Test public void testRootGetTotalLength() {
|
||||
assertEquals(model.length(), rootNode.getTotalLength());
|
||||
}
|
||||
|
||||
public void testRootGetLine() {
|
||||
@Test public void testRootGetLine() {
|
||||
assertEquals(3, rootNode.getStartLine());
|
||||
}
|
||||
|
||||
public void testRootGetTotalLine() {
|
||||
@Test public void testRootGetTotalLine() {
|
||||
assertEquals(1, rootNode.getTotalStartLine());
|
||||
}
|
||||
|
||||
public void testRootEndLine() {
|
||||
@Test public void testRootEndLine() {
|
||||
assertEquals(8, rootNode.getEndLine());
|
||||
}
|
||||
|
||||
public void testRootTotalEndLine() {
|
||||
@Test public void testRootTotalEndLine() {
|
||||
assertEquals(10, rootNode.getTotalEndLine());
|
||||
}
|
||||
|
||||
public void testCompositeGetOffset() {
|
||||
@Test public void testCompositeGetOffset() {
|
||||
assertEquals(model.indexOf("kind"), kindNode.getOffset());
|
||||
}
|
||||
|
||||
public void testCompositeGetTotalOffset() {
|
||||
@Test public void testCompositeGetTotalOffset() {
|
||||
assertEquals(model.indexOf("{") + 1, kindNode.getTotalOffset());
|
||||
}
|
||||
|
||||
public void testCompositeGetLength() {
|
||||
@Test public void testCompositeGetLength() {
|
||||
assertEquals(model.indexOf(')') - model.indexOf("kind") + 1, kindNode.getLength());
|
||||
}
|
||||
|
||||
public void testCompositeGetTotalLength() {
|
||||
@Test public void testCompositeGetTotalLength() {
|
||||
assertEquals(model.indexOf(')') - model.indexOf("{"), kindNode.getTotalLength());
|
||||
}
|
||||
|
||||
public void testCompositeGetLine() {
|
||||
@Test public void testCompositeGetLine() {
|
||||
assertEquals(5, kindNode.getStartLine());
|
||||
}
|
||||
|
||||
public void testCompositeGetTotalLine() {
|
||||
@Test public void testCompositeGetTotalLine() {
|
||||
assertEquals(3, kindNode.getTotalStartLine());
|
||||
}
|
||||
|
||||
public void testCompositeEndLine() {
|
||||
@Test public void testCompositeEndLine() {
|
||||
assertEquals(6, kindNode.getEndLine());
|
||||
}
|
||||
|
||||
public void testCompositeTotalEndLine() {
|
||||
@Test public void testCompositeTotalEndLine() {
|
||||
assertEquals(6, kindNode.getTotalEndLine());
|
||||
}
|
||||
|
||||
public void testLeafGetOffset() {
|
||||
@Test public void testLeafGetOffset() {
|
||||
assertEquals(model.indexOf("kind"), kindLeaf.getOffset());
|
||||
}
|
||||
|
||||
public void testLeafGetTotalOffset() {
|
||||
@Test public void testLeafGetTotalOffset() {
|
||||
assertEquals(model.indexOf("kind"), kindLeaf.getOffset());
|
||||
}
|
||||
|
||||
public void testLeafGetLength() {
|
||||
@Test public void testLeafGetLength() {
|
||||
assertEquals("kind".length(), kindLeaf.getLength());
|
||||
}
|
||||
|
||||
public void testLeafGetTotalLength() {
|
||||
@Test public void testLeafGetTotalLength() {
|
||||
assertEquals("kind".length(), kindLeaf.getLength());
|
||||
}
|
||||
|
||||
public void testLeafGetLine() {
|
||||
@Test public void testLeafGetLine() {
|
||||
assertEquals(5, kindLeaf.getStartLine());
|
||||
}
|
||||
|
||||
public void testLeafGetTotalLine() {
|
||||
@Test public void testLeafGetTotalLine() {
|
||||
assertEquals(5, kindLeaf.getTotalStartLine());
|
||||
}
|
||||
|
||||
public void testLeafEndLine() {
|
||||
@Test public void testLeafEndLine() {
|
||||
assertEquals(5, kindLeaf.getEndLine());
|
||||
}
|
||||
|
||||
public void testLeafTotalEndLine() {
|
||||
@Test public void testLeafTotalEndLine() {
|
||||
assertEquals(5, kindLeaf.getTotalEndLine());
|
||||
}
|
||||
|
||||
public void testHiddenLeafGetOffset() {
|
||||
@Test public void testHiddenLeafGetOffset() {
|
||||
assertEquals(model.indexOf("kind") + "kind".length(), hiddenLeaf.getOffset());
|
||||
}
|
||||
|
||||
public void testHiddenLeafGetTotalOffset() {
|
||||
@Test public void testHiddenLeafGetTotalOffset() {
|
||||
assertEquals(model.indexOf("kind") + "kind".length(), hiddenLeaf.getOffset());
|
||||
}
|
||||
|
||||
public void testHiddenLeafGetLength() {
|
||||
@Test public void testHiddenLeafGetLength() {
|
||||
assertEquals(" ".length(), hiddenLeaf.getLength());
|
||||
}
|
||||
|
||||
public void testHiddenLeafGetTotalLength() {
|
||||
@Test public void testHiddenLeafGetTotalLength() {
|
||||
assertEquals(" ".length(), hiddenLeaf.getLength());
|
||||
}
|
||||
|
||||
public void testHiddenLeafGetLine() {
|
||||
@Test public void testHiddenLeafGetLine() {
|
||||
assertEquals(5, hiddenLeaf.getStartLine());
|
||||
}
|
||||
|
||||
public void testHiddenLeafGetTotalLine() {
|
||||
@Test public void testHiddenLeafGetTotalLine() {
|
||||
assertEquals(5, hiddenLeaf.getTotalStartLine());
|
||||
}
|
||||
|
||||
public void testHiddenLeafEndLine() {
|
||||
@Test public void testHiddenLeafEndLine() {
|
||||
assertEquals(5, hiddenLeaf.getEndLine());
|
||||
}
|
||||
|
||||
public void testHiddenLeafTotalEndLine() {
|
||||
@Test public void testHiddenLeafTotalEndLine() {
|
||||
assertEquals(5, kindLeaf.getTotalEndLine());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,12 @@ import org.eclipse.xtext.Keyword;
|
|||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.testlanguages.TestLanguageStandaloneSetup;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
|
@ -42,12 +40,12 @@ public class NodeModelTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(TestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testNavigabilityAst2Node() throws Exception {
|
||||
@Test public void testNavigabilityAst2Node() throws Exception {
|
||||
EObject object = getModel(MODEL);
|
||||
checkNavigabilityAst2Node(object);
|
||||
for (Iterator<EObject> i = object.eAllContents(); i.hasNext();) {
|
||||
|
@ -55,7 +53,7 @@ public class NodeModelTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testNavigabilityNode2Ast() throws Exception {
|
||||
@Test public void testNavigabilityNode2Ast() throws Exception {
|
||||
EObject object = getModel(MODEL);
|
||||
EList<Adapter> adapters = object.eAdapters();
|
||||
assertEquals(1 /* compositeNode */ + 1 /* cache */, adapters.size());
|
||||
|
@ -67,7 +65,7 @@ public class NodeModelTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testGrammarElement() throws Exception {
|
||||
@Test public void testGrammarElement() throws Exception {
|
||||
ICompositeNode rootNode = getRootNode(MODEL);
|
||||
EObject rootGrammarElement = rootNode.getGrammarElement();
|
||||
assertTrue(rootGrammarElement instanceof ParserRule);
|
||||
|
@ -114,7 +112,7 @@ public class NodeModelTest extends AbstractXtextTests {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void testTokenTexts() throws Exception {
|
||||
@Test public void testTokenTexts() throws Exception {
|
||||
Pattern whitespacePattern = Pattern.compile("\\s*");
|
||||
String[] tokenTexts = MODEL.split(" ");
|
||||
int tokenIndex = 0;
|
||||
|
@ -131,7 +129,7 @@ public class NodeModelTest extends AbstractXtextTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testKeywordInAlternative() throws Exception {
|
||||
@Test public void testKeywordInAlternative() throws Exception {
|
||||
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
|
||||
EObject object = getModel("d / e");
|
||||
ICompositeNode root = NodeModelUtils.getNode(object).getRootNode();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package org.eclipse.xtext.nodemodel;
|
||||
|
||||
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -15,7 +16,7 @@ import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
|||
public class RootNodeTest extends AbstractCompositeNodeTest {
|
||||
|
||||
@Override
|
||||
public void testTextOffsetLength() {
|
||||
@Test public void testTextOffsetLength() {
|
||||
RootNode rootNode = createCompositeNode();
|
||||
String completeContent = "completeContent";
|
||||
rootNode.basicSetCompleteContent(completeContent);
|
||||
|
@ -34,7 +35,7 @@ public class RootNodeTest extends AbstractCompositeNodeTest {
|
|||
return new RootNode();
|
||||
}
|
||||
|
||||
public void testIteratorForEmptyNode() {
|
||||
@Test public void testIteratorForEmptyNode() {
|
||||
RootNode rootNode = createCompositeNode();
|
||||
BidiTreeIterator<AbstractNode> forwardIterator = rootNode.basicIterator();
|
||||
assertTrue(forwardIterator.hasNext());
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
package org.eclipse.xtext.nodemodel;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.impl.SyntheticCompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSetup;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -19,12 +20,12 @@ import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSe
|
|||
public class TreeIteratorTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testTreeIteratorForSyntheticNodes_Forward() throws Exception {
|
||||
@Test public void testTreeIteratorForSyntheticNodes_Forward() throws Exception {
|
||||
EObject object = getModel("(d - e) / e * d // fasdf s");
|
||||
ICompositeNode root = NodeModelUtils.getNode(object).getRootNode();
|
||||
INode firstChild = root.getFirstChild();
|
||||
|
@ -42,7 +43,7 @@ public class TreeIteratorTest extends AbstractXtextTests {
|
|||
assertEquals(expectedLastChild, lastChild);
|
||||
}
|
||||
|
||||
public void testTreeIteratorForSyntheticNodes_Backwards() throws Exception {
|
||||
@Test public void testTreeIteratorForSyntheticNodes_Backwards() throws Exception {
|
||||
EObject object = getModel("d - e / e * d");
|
||||
ICompositeNode root = NodeModelUtils.getNode(object).getRootNode();
|
||||
INode firstChild = root.getFirstChild();
|
||||
|
|
|
@ -21,11 +21,12 @@ 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.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.SyntheticCompositeNode;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -33,12 +34,12 @@ import org.eclipse.xtext.nodemodel.impl.SyntheticCompositeNode;
|
|||
*/
|
||||
public class NodeModelUtilsTest extends AbstractXtextTests {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(new XtextStandaloneSetup());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature() throws Exception {
|
||||
@Test public void testFindNodesForFeature() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model : name=ID;");
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(grammar, XtextPackage.eINSTANCE.getGrammar_Name());
|
||||
assertEquals(1, nodes.size());
|
||||
|
@ -54,7 +55,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals("foo", nodes.get(0).getText().trim());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature_MultipleFeature() throws Exception {
|
||||
@Test public void testFindNodesForFeature_MultipleFeature() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model : foo=Foo; Foo : name=ID; ");
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(grammar, XtextPackage.eINSTANCE.getGrammar_Rules());
|
||||
assertEquals(2, nodes.size());
|
||||
|
@ -62,7 +63,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals("Foo : name=ID;", nodes.get(1).getText().trim());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature_CallToConcreteRule() throws Exception {
|
||||
@Test public void testFindNodesForFeature_CallToConcreteRule() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model returns X: name='foo';");
|
||||
AbstractRule rule = grammar.getRules().get(0);
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(rule, XtextPackage.eINSTANCE.getAbstractRule_Type());
|
||||
|
@ -70,7 +71,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals("X", nodes.get(0).getText().trim());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature_Cardinality_0() throws Exception {
|
||||
@Test public void testFindNodesForFeature_Cardinality_0() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model: name+='foo'*;");
|
||||
Assignment assignment = (Assignment) grammar.getRules().get(0).getAlternatives();
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(assignment, XtextPackage.eINSTANCE.getAbstractElement_Cardinality());
|
||||
|
@ -78,14 +79,14 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals("*", nodes.get(0).getText().trim());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature_Cardinality_1() throws Exception {
|
||||
@Test public void testFindNodesForFeature_Cardinality_1() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model: name+='foo'* name+='bar'*;");
|
||||
Group group = (Group) grammar.getRules().get(0).getAlternatives();
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(group, XtextPackage.eINSTANCE.getAbstractElement_Cardinality());
|
||||
assertEquals(0, nodes.size());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature_Cardinality_2() throws Exception {
|
||||
@Test public void testFindNodesForFeature_Cardinality_2() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model: (name+='foo'*)?;");
|
||||
Assignment assignment = (Assignment) grammar.getRules().get(0).getAlternatives();
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(assignment, XtextPackage.eINSTANCE.getAbstractElement_Cardinality());
|
||||
|
@ -94,7 +95,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals("?", nodes.get(1).getText());
|
||||
}
|
||||
|
||||
public void testFindNodesForFeature_Elements() throws Exception {
|
||||
@Test public void testFindNodesForFeature_Elements() throws Exception {
|
||||
Grammar grammar = (Grammar) getModel("grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:name='foo'|name='bar';");
|
||||
Alternatives body = (Alternatives) grammar.getRules().get(0).getAlternatives();
|
||||
List<INode> nodes = NodeModelUtils.findNodesForFeature(body, XtextPackage.eINSTANCE.getCompoundElement_Elements());
|
||||
|
@ -103,7 +104,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals("name='bar'", nodes.get(1).getText());
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_01() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_01() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:((name=ID));";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf('('));
|
||||
|
@ -111,7 +112,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_02() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_02() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:((name=ID)*)?;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode star = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf('*'));
|
||||
|
@ -122,7 +123,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_03() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_03() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:name=ID;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf('='));
|
||||
|
@ -130,7 +131,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_04() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_04() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:name=ID;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf("name"));
|
||||
|
@ -138,7 +139,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_05() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_05() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:name=ID;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf("ID"));
|
||||
|
@ -146,7 +147,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof RuleCall);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_06() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_06() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model: name=ID;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.lastIndexOf(" "));
|
||||
|
@ -154,7 +155,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_07() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_07() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:(name=ID|name=STRING?)*;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode star = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf('*'));
|
||||
|
@ -165,7 +166,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_08() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_08() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:/**/name=ID;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode leadingComment = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf('*'));
|
||||
|
@ -173,7 +174,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof Assignment);
|
||||
}
|
||||
|
||||
public void testFindActualSemanticObjectFor_09() throws Exception {
|
||||
@Test public void testFindActualSemanticObjectFor_09() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:name=ID/**/;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
ILeafNode trailingComment = NodeModelUtils.findLeafNodeAtOffset(NodeModelUtils.getNode(grammar), grammarString.indexOf('*'));
|
||||
|
@ -181,7 +182,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertTrue(object instanceof ParserRule);
|
||||
}
|
||||
|
||||
public void testCompactDump_1() throws Exception {
|
||||
@Test public void testCompactDump_1() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model:name=ID;";
|
||||
Grammar grammar = (Grammar) getModel(grammarString);
|
||||
String actual = NodeModelUtils.compactDump(NodeModelUtils.getNode(grammar.getMetamodelDeclarations().get(0)), true);
|
||||
|
@ -197,7 +198,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals(expected.toString(), actual);
|
||||
}
|
||||
|
||||
public void testCompactDump_2() throws Exception {
|
||||
@Test public void testCompactDump_2() throws Exception {
|
||||
String grammarString = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo x 'bar' Model:name=ID;";
|
||||
Grammar grammar = (Grammar) getModelAndExpect(getAsStream(grammarString), 1);
|
||||
String actual = NodeModelUtils.compactDump(NodeModelUtils.getNode(grammar.getMetamodelDeclarations().get(0)), true);
|
||||
|
@ -215,7 +216,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals(expected.toString(), actual);
|
||||
}
|
||||
|
||||
public void testCompactDump_3() throws Exception {
|
||||
@Test public void testCompactDump_3() throws Exception {
|
||||
String grammarString = "grammar 1 2";
|
||||
Grammar grammar = (Grammar) getModelAndExpect(getAsStream(grammarString), UNKNOWN_EXPECTATION);
|
||||
String actual = NodeModelUtils.compactDump(NodeModelUtils.getNode(grammar), true);
|
||||
|
@ -232,7 +233,7 @@ public class NodeModelUtilsTest extends AbstractXtextTests {
|
|||
assertEquals(expected.toString(), actual);
|
||||
}
|
||||
|
||||
public void testFindLeafNodeAtOffset_1() throws Exception {
|
||||
@Test public void testFindLeafNodeAtOffset_1() throws Exception {
|
||||
String grammarText = "grammar foo.Bar with org.eclipse.xtext.common.Terminals generate foo 'bar' Model : (name=ID value=ID);";
|
||||
Grammar grammar = (Grammar) getModel(grammarText);
|
||||
int equalsSign = grammarText.indexOf('=');
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
|
|||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.XtextFactory;
|
||||
import org.eclipse.xtext.XtextGrammarTestLanguageStandaloneSetup;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
|
@ -35,6 +35,7 @@ import org.eclipse.xtext.xtextTest.Assignment;
|
|||
import org.eclipse.xtext.xtextTest.Grammar;
|
||||
import org.eclipse.xtext.xtextTest.Keyword;
|
||||
import org.eclipse.xtext.xtextTest.RuleCall;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -44,12 +45,12 @@ import com.google.common.collect.Lists;
|
|||
public class ParseErrorHandlingTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(XtextGrammarTestLanguageStandaloneSetup.class);
|
||||
}
|
||||
|
||||
public void testLexerError_01() throws Exception {
|
||||
@Test public void testLexerError_01() throws Exception {
|
||||
String model = "grammar a import 'holla' % as foo";
|
||||
EObject root = getModelAndExpect(model, 2);
|
||||
Iterable<INode> errors = ((XtextResource) root.eResource()).getParseResult().getSyntaxErrors();
|
||||
|
@ -60,7 +61,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
assertEquals(1, errors.iterator().next().getTotalLength());
|
||||
}
|
||||
|
||||
public void testParseError1() throws Exception {
|
||||
@Test public void testParseError1() throws Exception {
|
||||
String model = "grammar a import 'holla' foo returns x::y::Z : name=ID;";
|
||||
EObject root = getModelAndExpect(model, 5);
|
||||
Iterable<INode> errors = ((XtextResource) root.eResource()).getParseResult().getSyntaxErrors();
|
||||
|
@ -71,7 +72,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
assertEquals(1, Iterables.size(errors));
|
||||
}
|
||||
|
||||
public void testParseError2() throws Exception {
|
||||
@Test public void testParseError2() throws Exception {
|
||||
Grammar grammar = (Grammar) getModelAndExpect("grammar a import 'holla' foo returns y::Z : name=foo #;", 4);
|
||||
AbstractRule rule = grammar.getRules().get(0);
|
||||
Assignment assignment = (Assignment) rule.getAlternatives();
|
||||
|
@ -80,7 +81,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
// assertWithXtend("'foo'", "rules.first().eAllContents().typeSelect(RuleCall).first().rule.name", grammar);
|
||||
}
|
||||
|
||||
public void testParseError3() throws Exception {
|
||||
@Test public void testParseError3() throws Exception {
|
||||
Grammar grammar = (Grammar) getModelAndExpect("grammar a import 'holla' foo returns y::Z : name=foo #############", 4);
|
||||
AbstractRule rule = grammar.getRules().get(0);
|
||||
Assignment assignment = (Assignment) rule.getAlternatives();
|
||||
|
@ -89,7 +90,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
// assertWithXtend("'foo'", "rules.first().eAllContents().typeSelect(RuleCall).first().rule.name", grammar);
|
||||
}
|
||||
|
||||
public void testParseError4() throws Exception {
|
||||
@Test public void testParseError4() throws Exception {
|
||||
Grammar grammar = (Grammar) getModelAndExpect("grammar a import 'holla' foo returns y::Z : name=foo # 'foo'; bar : 'stuff'", 5);
|
||||
AbstractRule rule = grammar.getRules().get(0);
|
||||
Assignment assignment = (Assignment) rule.getAlternatives();
|
||||
|
@ -103,7 +104,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
// assertWithXtend("'stuff'", "rules.get(1).eAllContents().typeSelect(Keyword).first().value", grammar);
|
||||
}
|
||||
|
||||
public void testExpectNoSuchMethodException() throws Exception {
|
||||
@Test public void testExpectNoSuchMethodException() throws Exception {
|
||||
IParser parser = get(IParser.class);
|
||||
ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
|
||||
parserRule.setName("ruleDoesNotExist");
|
||||
|
@ -118,7 +119,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
}
|
||||
|
||||
|
||||
public void testName() throws Exception {
|
||||
@Test public void testName() throws Exception {
|
||||
String model = "grammar a import 'holla' foo returns y::Z : name=ID # 'foo'; bar : 'stuff'";
|
||||
for (int i=model.length();0<i;i--) {
|
||||
getModelAndExpect(model.substring(0, i), EXPECT_ERRORS);
|
||||
|
@ -129,7 +130,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=236425
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testBug236425() throws Exception {
|
||||
@Test public void testBug236425() throws Exception {
|
||||
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
|
||||
String model = "spielplatz 100 }";
|
||||
EObject object = getModelAndExpect(model, 1);
|
||||
|
@ -149,7 +150,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
};
|
||||
}
|
||||
|
||||
public void testLexerError_02() throws Exception {
|
||||
@Test public void testLexerError_02() throws Exception {
|
||||
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
|
||||
String model = "spielplatz 100 '}";
|
||||
EObject object = getModelAndExpect(model, 1);
|
||||
|
@ -157,7 +158,7 @@ public class ParseErrorHandlingTest extends AbstractXtextTests {
|
|||
assertEquals(1, Iterables.size(allSyntaxErrors(node)));
|
||||
}
|
||||
|
||||
public void testTrailingRecoverableError() throws Exception {
|
||||
@Test public void testTrailingRecoverableError() throws Exception {
|
||||
with(TreeTestLanguageStandaloneSetup.class);
|
||||
String model = "parent ('Teststring') { \n" +
|
||||
" child ('Teststring'){};\n" +
|
||||
|
|
|
@ -12,11 +12,12 @@ import java.io.InputStream;
|
|||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.InternalEObject;
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
|
||||
import org.eclipse.xtext.parser.partialParsingTestUtil.PartialParsingTestUtilPackage;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSetup;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
|
@ -24,7 +25,7 @@ import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSe
|
|||
public abstract class AbstractPartialParserCrossContainmentTest extends AbstractXtextTests {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
|
||||
PartialParsingTestUtilPackage.eINSTANCE.eAdapters(); // initialize
|
||||
|
@ -37,44 +38,44 @@ public abstract class AbstractPartialParserCrossContainmentTest extends Abstract
|
|||
return result;
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_01_Hugo_Plus_Egon() throws Exception {
|
||||
@Test public void testCrossResourceContainment_01_Hugo_Plus_Egon() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 2, 2, "+hugo+egon", true);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_01_Egon() throws Exception {
|
||||
@Test public void testCrossResourceContainment_01_Egon() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 8, 5, "egon", false);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_01_Empty() throws Exception {
|
||||
@Test public void testCrossResourceContainment_01_Empty() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 1, 2, "", true);
|
||||
replaceAndReparse(model, 3, 1, "(x+y+z)", true);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_01_X_Y_Z() throws Exception {
|
||||
@Test public void testCrossResourceContainment_01_X_Y_Z() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 3, 1, "(x+y+z)", true);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_02_Multiply() throws Exception {
|
||||
@Test public void testCrossResourceContainment_02_Multiply() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 6, 3, "*", false);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_02_Plus() throws Exception {
|
||||
@Test public void testCrossResourceContainment_02_Plus() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse("a b", 1, 1, "+", false);
|
||||
replaceAndReparse(model, 3, 1, "x)+(b",false);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_02_New_Parens() throws Exception {
|
||||
@Test public void testCrossResourceContainment_02_New_Parens() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 3, 1, "x)+(b",false);
|
||||
}
|
||||
|
||||
public void testCrossResourceContainment_03() throws Exception {
|
||||
@Test public void testCrossResourceContainment_03() throws Exception {
|
||||
String model = "(a+b+c)*(c/d)";
|
||||
replaceAndReparse(model, 0, model.length(), model, false);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.parser;
|
||||
|
||||
import org.eclipse.xtext.junit.AbstractXtextTests;
|
||||
import org.eclipse.xtext.junit4.AbstractXtextTests;
|
||||
import org.eclipse.xtext.nodemodel.BidiTreeIterator;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
|
@ -26,14 +26,14 @@ public abstract class AbstractPartialParserTest extends AbstractXtextTests {
|
|||
protected PartialParsingHelper partialParser;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
partialParser = new PartialParsingHelper();
|
||||
comparator = new EmfStructureComparator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception {
|
||||
comparator = null;
|
||||
partialParser = null;
|
||||
super.tearDown();
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.parser;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.antlr.runtime.CommonToken;
|
||||
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
|
||||
import org.eclipse.xtext.parser.impl.DatatypeRuleToken;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
public class AntlrDatatypeRuleTokenTest extends TestCase {
|
||||
public class AntlrDatatypeRuleTokenTest extends Assert {
|
||||
|
||||
private static final int TOKEN_TYPE = Integer.MIN_VALUE;
|
||||
|
||||
public void testConstructor() {
|
||||
@Test public void testConstructor() {
|
||||
DatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
assertNull(token.getText());
|
||||
assertEquals(DatatypeRuleToken.INITIAL_OFFSET, token.getStartOffset());
|
||||
|
@ -28,7 +28,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals("AntlrDatatypeRuleToken{\n\tstartOffset: -1\n\texpectedOffset: -1\n\tbufferValue: ''\n}", token.toString());
|
||||
}
|
||||
|
||||
public void testSetText() {
|
||||
@Test public void testSetText() {
|
||||
DatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
token.setText("text");
|
||||
assertEquals("text", token.getText());
|
||||
|
@ -40,7 +40,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertNull(token.getText());
|
||||
}
|
||||
|
||||
public void testMergeFirstToken() {
|
||||
@Test public void testMergeFirstToken() {
|
||||
CommonToken commonToken = new CommonToken(TOKEN_TYPE, "text");
|
||||
commonToken.setStartIndex(4);
|
||||
AntlrDatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
|
@ -49,7 +49,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(8, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeFirstDatatypeRuleToken() {
|
||||
@Test public void testMergeFirstDatatypeRuleToken() {
|
||||
AntlrDatatypeRuleToken tokenToMerge = new AntlrDatatypeRuleToken();
|
||||
tokenToMerge.setText("text");
|
||||
tokenToMerge.setStartOffset(6);
|
||||
|
@ -59,7 +59,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(10, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeSecondToken() {
|
||||
@Test public void testMergeSecondToken() {
|
||||
CommonToken tokenToMerge = new CommonToken(TOKEN_TYPE, "ext");
|
||||
tokenToMerge.setStartIndex(6);
|
||||
AntlrDatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
|
@ -71,7 +71,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(9, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeSecondDatatypeRuleToken() {
|
||||
@Test public void testMergeSecondDatatypeRuleToken() {
|
||||
AntlrDatatypeRuleToken tokenToMerge = new AntlrDatatypeRuleToken();
|
||||
tokenToMerge.setText("ext");
|
||||
tokenToMerge.setStartOffset(9);
|
||||
|
@ -84,7 +84,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(12, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeSecondTokenUnmatched() {
|
||||
@Test public void testMergeSecondTokenUnmatched() {
|
||||
CommonToken tokenToMerge = new CommonToken(TOKEN_TYPE, "ext");
|
||||
tokenToMerge.setStartIndex(6);
|
||||
AntlrDatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
|
@ -96,7 +96,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(9, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeSecondDatatypeRuleTokenUnmatched() {
|
||||
@Test public void testMergeSecondDatatypeRuleTokenUnmatched() {
|
||||
AntlrDatatypeRuleToken tokenToMerge = new AntlrDatatypeRuleToken();
|
||||
tokenToMerge.setText("ext");
|
||||
tokenToMerge.setStartOffset(9);
|
||||
|
@ -109,7 +109,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(12, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeEmptyToken() {
|
||||
@Test public void testMergeEmptyToken() {
|
||||
AntlrDatatypeRuleToken emptyToken = new AntlrDatatypeRuleToken();
|
||||
AntlrDatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
token.setStartOffset(1);
|
||||
|
@ -120,7 +120,7 @@ public class AntlrDatatypeRuleTokenTest extends TestCase {
|
|||
assertEquals(2, token.getExpectedOffset());
|
||||
}
|
||||
|
||||
public void testMergeEmptyTokenWithOffset() {
|
||||
@Test public void testMergeEmptyTokenWithOffset() {
|
||||
AntlrDatatypeRuleToken emptyToken = new AntlrDatatypeRuleToken();
|
||||
emptyToken.setStartOffset(9);
|
||||
AntlrDatatypeRuleToken token = new AntlrDatatypeRuleToken();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue