public void ErrorsAttachedAsAnnotations() { string ftl = "foo = "; var output = new Ast.Junk() { Content = "foo = ", Span = new Ast.Span( new Position(0, 1, 1), new Position(6, 1, 7)) }; output.AddAnnotation(new Ast.Annotation() { Code = "E0005", Message = "Expected message \"foo\" to have a value or attributes", Args = new string[] { "foo" }, Span = new Ast.Span( new Position(6, 1, 7), new Position(6, 1, 7)) }); using (var sr = new StringReader(ftl)) { var ps = new Parser(true); var message = ps.ParseEntry(sr); message.Should().BeEquivalentTo(output, options => options.RespectingRuntimeTypes()); } }
public void ReturnJunk() { string ftl = @" # Attached Comment junk "; var output = new Ast.Junk() { Content = "junk\n" }; output.AddAnnotation( new Ast.Annotation() { Args = new string[] { "=" }, Code = "E0003", Message = "Expected token: \"=\"", Span = Span(23, 23) } ); ParseAndCheck(ftl, output); }
public void DoNotIgnoreInvalidComments() { string ftl = @" # Attached Comment ##Invalid Comment "; var output = new Ast.Junk() { Content = "##Invalid Comment\n" }; output.AddAnnotation(new Ast.Annotation() { Args = new string[] { " " }, Code = "E0003", Message = "Expected token: \" \"", Span = new Ast.Span( new Position(21, 2, 3), new Position(21, 2, 3)) }); ParseAndCheck(ftl, output); }