public void TestErrorLine() { var diagnostics = GetDiagnostics("ErrorLine.lg"); Assert.Equal(4, diagnostics.Count); Assert.Equal(DiagnosticSeverity.Error, diagnostics[0].Severity); Assert.Contains(TemplateErrors.SyntaxError("mismatched input '-' expecting <EOF>"), diagnostics[0].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[1].Severity); Assert.Contains(TemplateErrors.InvalidStrucName("]"), diagnostics[1].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[2].Severity); Assert.Contains(TemplateErrors.MissingStrucEnd, diagnostics[2].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[3].Severity); Assert.Contains(TemplateErrors.InvalidStrucBody("- hi"), diagnostics[3].Message); }
public void TestErrorStructuredTemplate() { var diagnostics = GetDiagnostics("ErrorStructuredTemplate.lg"); Assert.Equal(8, diagnostics.Count); Assert.Equal(DiagnosticSeverity.Error, diagnostics[0].Severity); Assert.Contains(TemplateErrors.InvalidStrucBody("abc"), diagnostics[0].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[1].Severity); Assert.Contains(TemplateErrors.EmptyStrucContent, diagnostics[1].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[2].Severity); Assert.Contains("Error occurred when parsing expression 'NOTemplate()'. NOTemplate does not have an evaluator", diagnostics[2].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[3].Severity); Assert.Contains("Error occurred when parsing expression 'NOTemplate()'. NOTemplate does not have an evaluator", diagnostics[3].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[4].Severity); Assert.Contains(TemplateErrors.InvalidStrucName("Activity%"), diagnostics[4].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[5].Severity); Assert.Contains(TemplateErrors.InvalidStrucName("Activity]"), diagnostics[5].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[6].Severity); Assert.Contains(TemplateErrors.MissingStrucEnd, diagnostics[6].Message); Assert.Equal(DiagnosticSeverity.Error, diagnostics[7].Severity); Assert.Contains(TemplateErrors.InvalidStrucBody("- hi"), diagnostics[7].Message); }