{literal}
"; - - var pTagHelperBuilder = TagHelperDescriptorBuilder - .Create("PTagHelper", "SomeAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("p")); - foreach (var childTag in allowedChildren) - { - pTagHelperBuilder.AllowChildTag(childTag); - } - - var descriptors = new TagHelperDescriptor[] - { - pTagHelperBuilder.Build() - }; - - var factory = new SpanFactory(); - var blockFactory = new BlockFactory(factory); - - var expectedMarkup = new MarkupBlock( - new MarkupTagHelperBlock("p", - blockFactory.MarkupTagBlock(""), - factory.Markup(literal), - blockFactory.MarkupTagBlock(""), - blockFactory.HtmlCommentBlock(commentOutput))); - - // Act & Assert - EvaluateData( - descriptors, - expectedOutput, - expectedMarkup, - Array.Empty{literal}
"; - - var pTagHelperBuilder = TagHelperDescriptorBuilder - .Create("PTagHelper", "SomeAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("p")); - foreach (var childTag in allowedChildren) - { - pTagHelperBuilder.AllowChildTag(childTag); - } - - var descriptors = new TagHelperDescriptor[] - { - pTagHelperBuilder.Build() - }; - - var factory = new SpanFactory(); - var blockFactory = new BlockFactory(factory); - - var expectedMarkup = new MarkupBlock( - new MarkupTagHelperBlock("p", - blockFactory.HtmlCommentBlock(comment1), - factory.Markup(literal), - blockFactory.HtmlCommentBlock(comment2))); - - // Act & Assert - EvaluateData( - descriptors, - expectedOutput, - expectedMarkup, - new[] - { - nestedContentError("p", "b", 15, 4), - }); - } - - [Fact] - public void Rewrite_AllowsRazorCommentsAsChildren() - { - // Arrange - IEnumerable{literal}{commentOutput}
"; - - var pTagHelperBuilder = TagHelperDescriptorBuilder - .Create("PTagHelper", "SomeAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("p")); - foreach (var childTag in allowedChildren) - { - pTagHelperBuilder.AllowChildTag(childTag); - } - - var descriptors = new TagHelperDescriptor[] - { - pTagHelperBuilder.Build() - }; - - var factory = new SpanFactory(); - var blockFactory = new BlockFactory(factory); - - var expectedMarkup = new MarkupBlock( - new MarkupTagHelperBlock("p", - blockFactory.MarkupTagBlock(""), - factory.Markup(literal), - blockFactory.MarkupTagBlock(""), - new CommentBlock( - Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition).Accepts(AcceptedCharactersInternal.None), - Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharactersInternal.None), - Factory.Span(SpanKindInternal.Comment, new HtmlSymbol(literal, HtmlSymbolType.RazorComment)).Accepts(AcceptedCharactersInternal.Any), - Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharactersInternal.None), - Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition).Accepts(AcceptedCharactersInternal.None)))); - - // Act & Assert - EvaluateData( - descriptors, - expectedOutput, - expectedMarkup, - Array.Empty{literal}{commentStart}{part1}@{part2}{commentEnd}
"; - - var pTagHelperBuilder = TagHelperDescriptorBuilder - .Create("PTagHelper", "SomeAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("p")); - foreach (var childTag in allowedChildren) - { - pTagHelperBuilder.AllowChildTag(childTag); - } - - var descriptors = new TagHelperDescriptor[] - { - pTagHelperBuilder.Build() - }; - - var factory = new SpanFactory(); - var blockFactory = new BlockFactory(factory); - - var expectedMarkup = new MarkupBlock( - new MarkupTagHelperBlock("p", - blockFactory.MarkupTagBlock(""), - factory.Markup(literal), - blockFactory.MarkupTagBlock(""), - BlockFactory.HtmlCommentBlock(factory, f => new SyntaxTreeNode[] { - f.Markup(part1).Accepts(AcceptedCharactersInternal.WhiteSpace), - new ExpressionBlock( - f.CodeTransition(), - f.Code(part2) - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)) }))); - - // Act & Assert - EvaluateData( - descriptors, - expectedOutput, - expectedMarkup, - Array.Empty
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt
index 046cad8407..343985c189 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt
@@ -5,10 +5,7 @@ Document -
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double_Runtime - -
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
HtmlContent - (0:0,0 [45] HtmlCommentWithQuote_Double.cshtml)
- IntermediateToken - (0:0,0 [4] HtmlCommentWithQuote_Double.cshtml) - Html -
- IntermediateToken - (10:0,10 [2] HtmlCommentWithQuote_Double.cshtml) - Html - \n
+ IntermediateToken - (0:0,0 [12] HtmlCommentWithQuote_Double.cshtml) - Html - \n
IntermediateToken - (12:1,0 [4] HtmlCommentWithQuote_Double.cshtml) - Html -
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt
index 8b5f5b3ed5..04795676d1 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt
@@ -10,10 +10,7 @@ Document -
IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
HtmlContent - (0:0,0 [45] HtmlCommentWithQuote_Single.cshtml)
- IntermediateToken - (0:0,0 [4] HtmlCommentWithQuote_Single.cshtml) - Html -
- IntermediateToken - (10:0,10 [2] HtmlCommentWithQuote_Single.cshtml) - Html - \n
+ IntermediateToken - (0:0,0 [12] HtmlCommentWithQuote_Single.cshtml) - Html - \n
IntermediateToken - (12:1,0 [4] HtmlCommentWithQuote_Single.cshtml) - Html -
diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt
index 8596f51503..65aafb6fe7 100644
--- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt
+++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt
@@ -5,10 +5,7 @@ Document -
ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single_Runtime - -
MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync
HtmlContent - (0:0,0 [45] HtmlCommentWithQuote_Single.cshtml)
- IntermediateToken - (0:0,0 [4] HtmlCommentWithQuote_Single.cshtml) - Html -
- IntermediateToken - (10:0,10 [2] HtmlCommentWithQuote_Single.cshtml) - Html - \n
+ IntermediateToken - (0:0,0 [12] HtmlCommentWithQuote_Single.cshtml) - Html - \n
IntermediateToken - (12:1,0 [4] HtmlCommentWithQuote_Single.cshtml) - Html -
diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/BlockFactory.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/BlockFactory.cs
index 2551fee917..5c2ee95394 100644
--- a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/BlockFactory.cs
+++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/BlockFactory.cs
@@ -1,7 +1,6 @@
// 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;
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language.Legacy
@@ -56,24 +55,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
);
}
- public HtmlCommentBlock HtmlCommentBlock(string content)
- {
- return HtmlCommentBlock(_factory, f => new SyntaxTreeNode[] { f.Markup(content).Accepts(AcceptedCharactersInternal.WhiteSpace) });
- }
-
- public static HtmlCommentBlock HtmlCommentBlock(SpanFactory factory, Func