forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHtmlParserTestUtils.cs
More file actions
40 lines (37 loc) · 1.75 KB
/
Copy pathHtmlParserTestUtils.cs
File metadata and controls
40 lines (37 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Web.Razor.Parser;
using System.Web.Razor.Parser.SyntaxTree;
using System.Web.Razor.Test.Framework;
namespace System.Web.Razor.Test.Parser.Html
{
internal class HtmlParserTestUtils
{
public static void RunSingleAtEscapeTest(Action<string, Block> testMethod, AcceptedCharacters lastSpanAcceptedCharacters = AcceptedCharacters.None)
{
var factory = SpanFactory.CreateCsHtml();
testMethod("<foo>@@bar</foo>",
new MarkupBlock(
factory.Markup("<foo>"),
factory.Markup("@").Hidden(),
factory.Markup("@bar</foo>").Accepts(lastSpanAcceptedCharacters)));
}
public static void RunMultiAtEscapeTest(Action<string, Block> testMethod, AcceptedCharacters lastSpanAcceptedCharacters = AcceptedCharacters.None)
{
var factory = SpanFactory.CreateCsHtml();
testMethod("<foo>@@@@@bar</foo>",
new MarkupBlock(
factory.Markup("<foo>"),
factory.Markup("@").Hidden(),
factory.Markup("@"),
factory.Markup("@").Hidden(),
factory.Markup("@"),
new ExpressionBlock(
factory.CodeTransition(),
factory.Code("bar")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
.Accepts(AcceptedCharacters.NonWhiteSpace)),
factory.Markup("</foo>").Accepts(lastSpanAcceptedCharacters)));
}
}
}