public void ParseSectionBlockReportsErrorAndAcceptsWhitespaceToEndOfLineIfSectionNotFollowedByOpenBrace() { // Arrange var chunkGenerator = new DirectiveChunkGenerator(SectionDirective.Directive); chunkGenerator.Diagnostics.Add( RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( new SourceSpan(new SourceLocation(18 + Environment.NewLine.Length, 1, 0), contentLength: 1), SectionDirective.Directive.Directive, "{")); // Act & Assert ParseDocumentTest( "@section foo " + Environment.NewLine, new[] { SectionDirective.Directive }); }
public void ParseInheritsStatementMarksInheritsSpanAsCanGrowIfMissingTrailingSpace() { // Arrange var chunkGenerator = new DirectiveChunkGenerator(InheritsDirective.Directive); chunkGenerator.Diagnostics.Add( RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( new SourceSpan(new SourceLocation(9, 0, 9), 1), InheritsDirective.Directive.Directive, "type")); // Act & Assert ParseDocumentTest( "@inherits", new[] { InheritsDirective.Directive }, new MarkupBlock( Factory.EmptyHtml(), new DirectiveBlock(chunkGenerator, Factory.CodeTransition(), Factory.MetaCode("inherits").Accepts(AcceptedCharactersInternal.None), Factory.Span(SpanKindInternal.Code, string.Empty, CSharpSymbolType.Unknown) .AsDirectiveToken(DirectiveTokenDescriptor.CreateToken(DirectiveTokenKind.Type))), Factory.EmptyHtml())); }