Exemple #1
0
 public void ParseBlockOutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart()
 {
     ParseBlockTest("if(foo) { @<p>Bar</p> }",
                    new StatementBlock(
                        Factory.Code("if(foo) {").AsStatement(),
                        new MarkupBlock(
                            Factory.Markup(" "),
                            Factory.MarkupTransition(),
                            BlockFactory.MarkupTagBlock("<p>", AcceptedCharactersInternal.None),
                            Factory.Markup("Bar"),
                            BlockFactory.MarkupTagBlock("</p>", AcceptedCharactersInternal.None),
                            Factory.Markup(" ").Accepts(AcceptedCharactersInternal.None)),
                        Factory.Code("}").AsStatement()
                        ),
                    RazorDiagnosticFactory.CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart(
                        new SourceSpan(new SourceLocation(10, 0, 10), contentLength: 1)));
 }
 public void ParseBlockGivesSpacesToCodeOnInvalidAtTagTransitionInDesignTimeMode()
 {
     ParseBlockTest("{" + Environment.NewLine
                    + "    @<p>Foo</p>    " + Environment.NewLine
                    + "}",
                    new StatementBlock(
                        Factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None),
                        Factory.Code(Environment.NewLine + "    ")
                        .AsStatement()
                        .AutoCompleteWith(autoCompleteString: null),
                        new MarkupBlock(
                            Factory.MarkupTransition(),
                            new MarkupTagBlock(
                                Factory.Markup("<p>").Accepts(AcceptedCharactersInternal.None)),
                            Factory.Markup("Foo"),
                            new MarkupTagBlock(
                                Factory.Markup("</p>").Accepts(AcceptedCharactersInternal.None))
                            ),
                        Factory.Code("    " + Environment.NewLine).AsStatement(),
                        Factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)
                        ), true,
                    RazorDiagnosticFactory.CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart(
                        new SourceSpan(new SourceLocation(5 + Environment.NewLine.Length, 1, 4), contentLength: 1)));
 }