summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhbehrens2009-04-28 06:21:18 (EDT)
committer sefftinge2009-04-28 06:21:18 (EDT)
commite7361c5963759690b9657e7233dd19a0adbc6465 (patch)
treeaac8721ad7d329f8d8ffecfeaff4250544a2c190
parenta12d99dc3ad3941f285c2e121df2a1c0102d22ee (diff)
downloadorg.eclipse.xtext-e7361c5963759690b9657e7233dd19a0adbc6465.zip
org.eclipse.xtext-e7361c5963759690b9657e7233dd19a0adbc6465.tar.gz
org.eclipse.xtext-e7361c5963759690b9657e7233dd19a0adbc6465.tar.bz2
* fix: Check that refuses enum with explicit empty literals ("") also works with imported enums
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextValidationTest.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextValidationTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextValidationTest.java
index 9554a02..095cd17 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextValidationTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/xtext/XtextValidationTest.java
@@ -106,7 +106,7 @@ public class XtextValidationTest extends AbstractGeneratorTest {
assertEquals("diag.isWarning", diag.getSeverity(), Diagnostic.WARNING);
}
- public void testEnumWithEmptyLiteral() throws Exception {
+ public void testEnumWithEmptyLiteralGenerated() throws Exception {
XtextResource resource = getResourceFromString(
"grammar org.foo.Bar with org.eclipse.xtext.common.Terminals\n" +
"generate testLanguage 'http://www.eclipse.org/2009/tmf/xtext/validation/literal/2'\n" +
@@ -121,4 +121,17 @@ public class XtextValidationTest extends AbstractGeneratorTest {
assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR);
}
+ public void testEnumWithEmptyLiteralImported() throws Exception {
+ XtextResource resource = getResourceFromString(
+ "grammar org.foo.Bar with org.eclipse.xtext.common.Terminals\n" +
+ "import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore'\n" +
+ "enum ExistingEnum: SameName | DifferentName='Diff' | OverriddenLiteral='';");
+ assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
+ assertTrue(resource.getWarnings().toString(), resource.getWarnings().isEmpty());
+
+ Diagnostic diag = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
+ assertNotNull("diag", diag);
+ assertEquals(diag.getChildren().toString(), 1, diag.getChildren().size());
+ assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR);
+ }
}