Beispiel #1
0
 public void ParseBlockOutputsZeroLengthCodeSpanIfEOFOccursAfterTransition()
 {
     ParseBlockTest("@",
                    new ExpressionBlock(
                        Factory.CodeTransition(),
                        Factory.EmptyCSharp()
                        .AsImplicitExpression(KeywordSet)
                        .Accepts(AcceptedCharactersInternal.NonWhiteSpace)),
                    RazorDiagnosticFactory.CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock(
                        new SourceSpan(new SourceLocation(1, 0, 1), contentLength: 1)));
 }
Beispiel #2
0
 public void ParseBlockMethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression()
 {
     ParseBlockTest("{" + Environment.NewLine
                    + "    @",
                    new StatementBlock(
                        Factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None),
                        Factory.Code(Environment.NewLine + "    ")
                        .AsStatement()
                        .AutoCompleteWith("}"),
                        new ExpressionBlock(
                            Factory.CodeTransition(),
                            Factory.EmptyCSharp()
                            .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true)
                            .Accepts(AcceptedCharactersInternal.NonWhiteSpace)),
                        Factory.EmptyCSharp().AsStatement()
                        ),
                    RazorDiagnosticFactory.CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock(
                        new SourceSpan(new SourceLocation(6 + Environment.NewLine.Length, 1, 5), contentLength: 1)),
                    RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF(
                        new SourceSpan(SourceLocation.Zero, contentLength: 1), Resources.BlockName_Code, "}", "{"));
 }