Search in sources :

Example 11 with ExceptionDiagnostic

use of org.eclipse.xtext.diagnostics.ExceptionDiagnostic in project xtext-core by eclipse.

the class Xtext2EcoreTransformerTest method testNoException_02.

@Test
public void testNoException_02() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("grammar test with org.eclipse.xtext.common.Terminals generate test \'http://test\'");
    _builder.newLine();
    _builder.append("Model: (children+=Element)*;");
    _builder.newLine();
    _builder.append("Element returns Type: Item ( { Item.items+=current } items+=Item );");
    _builder.newLine();
    _builder.append("Item returns Type:\t{ T");
    String grammar = _builder.toString();
    final XtextResource resource = this.getResourceFromStringAndExpect(grammar, 1);
    EList<Resource.Diagnostic> _errors = resource.getErrors();
    for (final Resource.Diagnostic d : _errors) {
        Assert.assertFalse((d instanceof ExceptionDiagnostic));
    }
}
Also used : ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) TransformationDiagnostic(org.eclipse.xtext.xtext.ecoreInference.TransformationDiagnostic) XtextResource(org.eclipse.xtext.resource.XtextResource) Test(org.junit.Test)

Example 12 with ExceptionDiagnostic

use of org.eclipse.xtext.diagnostics.ExceptionDiagnostic in project xtext-core by eclipse.

the class Xtext2EcoreTransformerTest method testBug_272566_3.

@Test
public void testBug_272566_3() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("grammar test with org.eclipse.xtext.common.Terminals");
    _builder.newLine();
    _builder.append("generate test \'http://test\'");
    _builder.newLine();
    _builder.append("Model:");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("test=Test");
    _builder.newLine();
    _builder.append(";");
    _builder.newLine();
    _builder.newLine();
    _builder.append("Test:");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("\"keyword\" MyEnum name=ID");
    _builder.newLine();
    _builder.append(";");
    _builder.newLine();
    _builder.append("enum MyEnum:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("A | B;");
    _builder.newLine();
    String grammar = _builder.toString();
    final XtextResource resource = this.getResourceFromStringAndExpect(grammar, 1);
    Assert.assertFalse(resource.getErrors().toString(), resource.getErrors().isEmpty());
    EList<Resource.Diagnostic> _errors = resource.getErrors();
    for (final Resource.Diagnostic d : _errors) {
        Assert.assertFalse((d instanceof ExceptionDiagnostic));
    }
}
Also used : ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) ExceptionDiagnostic(org.eclipse.xtext.diagnostics.ExceptionDiagnostic) TransformationDiagnostic(org.eclipse.xtext.xtext.ecoreInference.TransformationDiagnostic) XtextResource(org.eclipse.xtext.resource.XtextResource) Test(org.junit.Test)

Aggregations

ExceptionDiagnostic (org.eclipse.xtext.diagnostics.ExceptionDiagnostic)12 Diagnostic (org.eclipse.emf.ecore.resource.Resource.Diagnostic)6 BasicDiagnostic (org.eclipse.emf.common.util.BasicDiagnostic)5 Resource (org.eclipse.emf.ecore.resource.Resource)5 XtextResource (org.eclipse.xtext.resource.XtextResource)5 List (java.util.List)4 Severity (org.eclipse.xtext.diagnostics.Severity)4 IDiagnosticConverter (org.eclipse.xtext.validation.IDiagnosticConverter)4 Issue (org.eclipse.xtext.validation.Issue)4 ResourceValidatorImpl (org.eclipse.xtext.validation.ResourceValidatorImpl)4 Test (org.junit.Test)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 TransformationDiagnostic (org.eclipse.xtext.xtext.ecoreInference.TransformationDiagnostic)3 IOException (java.io.IOException)2 ComparisonFailure (org.junit.ComparisonFailure)2 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 EObject (org.eclipse.emf.ecore.EObject)1 Grammar (org.eclipse.xtext.Grammar)1 LazyLinkingResource (org.eclipse.xtext.linking.lazy.LazyLinkingResource)1 SerializerTestHelper (org.eclipse.xtext.testing.serializer.SerializerTestHelper)1