use of org.eclipse.emf.common.util.Diagnostic in project xtext-core by eclipse.
the class XtextValidationTest method testLeftRecursion_Bug_285605_10.
@Test
public void testLeftRecursion_Bug_285605_10() throws Exception {
XtextResource resource = getResourceFromString("grammar org.foo.Bar with org.eclipse.xtext.common.Terminals\n" + "generate foo 'http://foo/bar'\n" + "Y: x+=X? x+=X;\n" + "X: name=ID;\n");
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.getSeverity(), Diagnostic.OK);
assertTrue(diag.getChildren().toString(), diag.getChildren().isEmpty());
}
use of org.eclipse.emf.common.util.Diagnostic in project xtext-core by eclipse.
the class XtextValidationTest method testLeftRecursion_Bug_285605_12.
@Test
public void testLeftRecursion_Bug_285605_12() throws Exception {
XtextResource resource = getResourceFromString("grammar org.foo.Bar with org.eclipse.xtext.common.Terminals\n" + "generate foo 'http://foo/bar'\n" + "RuleA : ruleB=RuleB;\n" + "RuleB : ruleC=RuleC;\n" + "RuleC : '_'? ( ( '__' & ruleA+=RuleA )* '___')? name=ID;\n");
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(), 4, diag.getChildren().size());
assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR);
}
use of org.eclipse.emf.common.util.Diagnostic in project xtext-core by eclipse.
the class XtextValidationTest method testLeftRecursion_Bug_285605_09.
@Test
public void testLeftRecursion_Bug_285605_09() throws Exception {
XtextResource resource = getResourceFromString("grammar org.foo.Bar with org.eclipse.xtext.common.Terminals\n" + "generate foo 'http://foo/bar'\n" + "RuleA : ruleB=RuleB;\n" + "RuleB : ruleC=RuleC;\n" + "RuleC : '_'? ( ( '__' | ruleA+=RuleA )* '___')? name=ID;\n");
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(), 4, diag.getChildren().size());
assertEquals("diag.isError", diag.getSeverity(), Diagnostic.ERROR);
}
use of org.eclipse.emf.common.util.Diagnostic in project xtext-core by eclipse.
the class XtextValidationTest method testOverrideDeprecated.
@Test
public void testOverrideDeprecated() throws Exception {
XtextResourceSet rs = get(XtextResourceSet.class);
getResourceFromString("grammar org.xtext.Supergrammar with org.eclipse.xtext.common.Terminals\n" + "generate supergrammar \"http://org.xtext.supergrammar\"\n" + "@Deprecated\n" + "RuleDeprecated: name=ID;\n" + "Rule: name=ID;", "superGrammar.xtext", rs);
XtextResource resource = getResourceFromString("grammar org.foo.Bar with org.xtext.Supergrammar\n" + "generate bar \"http://org.xtext.Bar\"\n" + "@Override Rule: name=ID;", "foo.xtext", rs);
Diagnostic diag = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
List<Diagnostic> issues = diag.getChildren();
assertEquals(issues.toString(), 0, issues.size());
}
use of org.eclipse.emf.common.util.Diagnostic in project xtext-core by eclipse.
the class XtextValidationTest method testBug322875_02.
@Test
public void testBug322875_02() throws Exception {
URIConverter.URI_MAP.put(URI.createURI("platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"), URI.createURI(getClass().getResource("/model/Ecore.ecore").toExternalForm()));
String testGrammar = "grammar foo.Bar with org.eclipse.xtext.common.Terminals\n " + " import 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore' " + "Model returns EClass: name=ID;";
XtextResource resource = getResourceFromString(testGrammar);
Diagnostic diag = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
assertNotNull("diag", diag);
assertEquals(diag.toString(), 0, diag.getChildren().size());
assertEquals("diag.isOk", Diagnostic.OK, diag.getSeverity());
}
Aggregations