示例#1
0
        public void Rewrite_Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block()
        {
            // Arrange
            var factory = new SpanFactory();
            var start   = new MarkupBlock(
                factory.Markup("test"),
                new ExpressionBlock(
                    factory.Code("    ").AsExpression(),
                    factory.CodeTransition(SyntaxConstants.TransitionString),
                    factory.Code("foo").AsExpression()),
                factory.Markup("test"));
            var rewriter = new WhiteSpaceRewriter();

            // Act
            var rewritten = rewriter.Rewrite(start);

            factory.Reset();

            // Assert
            ParserTestBase.EvaluateParseTree(
                rewritten,
                new MarkupBlock(
                    factory.Markup("test"),
                    factory.Markup("    "),
                    new ExpressionBlock(
                        factory.CodeTransition(SyntaxConstants.TransitionString),
                        factory.Code("foo").AsExpression()),
                    factory.Markup("test")));
        }
示例#2
0
        public void Rewrite_Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block()
        {
            // Arrange
            var parsed = ParseDocument(
                RazorLanguageVersion.Latest,
                "test    @foo test",
                Array.Empty <DirectiveDescriptor>());

            var rewriter = new WhiteSpaceRewriter();

            // Act
            var rewritten = rewriter.Rewrite(parsed.Root);

            // Assert
            BaselineTest(parsed);
        }