Update tests to follow developer guidelines.
- Moved tests to match their corresponding test src files. - Updated test namespaces to match their corresponding test src files. #782
This commit is contained in:
parent
eb2b58188a
commit
9c4eee14b8
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.CodeGenerators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Parser;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test
|
namespace Microsoft.AspNetCore.Razor
|
||||||
{
|
{
|
||||||
public class CSharpRazorCodeLanguageTest
|
public class CSharpRazorCodeLanguageTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Chunks.Generators
|
namespace Microsoft.AspNetCore.Razor.Chunks
|
||||||
{
|
{
|
||||||
public class ChunkTreeBuilderTest
|
public class ChunkTreeBuilderTest
|
||||||
{
|
{
|
||||||
|
|
@ -7,7 +7,7 @@ using Moq;
|
||||||
using Moq.Protected;
|
using Moq.Protected;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Chunks.Generators
|
namespace Microsoft.AspNetCore.Razor.Chunks
|
||||||
{
|
{
|
||||||
public class ChunkVisitorTests
|
public class ChunkVisitorTests
|
||||||
{
|
{
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
using System;
|
using System;
|
||||||
#endif
|
#endif
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test;
|
using Microsoft.AspNetCore.Razor.Test.CodeGenerators;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Generator;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Utils;
|
using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,12 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Parser;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.CodeGenerators
|
||||||
{
|
{
|
||||||
public class CSharpPaddingBuilderTests
|
public class CSharpPaddingBuilderTests
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.CodeGenerators;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.CodeGenerators
|
||||||
{
|
{
|
||||||
public class RazorCodeGeneratorTest : RazorCodeGeneratorTest<CSharpRazorCodeLanguage>
|
public class CSharpRazorCodeGeneratorTest : RazorCodeGeneratorTest<CSharpRazorCodeLanguage>
|
||||||
{
|
{
|
||||||
protected override string FileExtension
|
protected override string FileExtension
|
||||||
{
|
{
|
||||||
|
|
@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class CSharpTagHelperRenderingTest : TagHelperTestBase
|
public class CSharpTagHelperRenderingTest : TagHelperTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -1832,31 +1832,31 @@ namespace Microsoft.AspNetCore.Razor.Test.Generator
|
||||||
documentAbsoluteIndex: 169,
|
documentAbsoluteIndex: 169,
|
||||||
documentLineIndex: 8,
|
documentLineIndex: 8,
|
||||||
documentCharacterOffsetIndex: 14,
|
documentCharacterOffsetIndex: 14,
|
||||||
generatedAbsoluteIndex: 1929,
|
generatedAbsoluteIndex: 1934,
|
||||||
generatedLineIndex: 50,
|
generatedLineIndex: 50,
|
||||||
generatedCharacterOffsetIndex: 96,
|
generatedCharacterOffsetIndex: 101,
|
||||||
contentLength: 7),
|
contentLength: 7),
|
||||||
BuildLineMapping(
|
BuildLineMapping(
|
||||||
documentAbsoluteIndex: 196,
|
documentAbsoluteIndex: 196,
|
||||||
documentLineIndex: 9,
|
documentLineIndex: 9,
|
||||||
documentCharacterOffsetIndex: 14,
|
documentCharacterOffsetIndex: 14,
|
||||||
generatedAbsoluteIndex: 2312,
|
generatedAbsoluteIndex: 2322,
|
||||||
generatedLineIndex: 57,
|
generatedLineIndex: 57,
|
||||||
generatedCharacterOffsetIndex: 96,
|
generatedCharacterOffsetIndex: 101,
|
||||||
contentLength: 13),
|
contentLength: 13),
|
||||||
BuildLineMapping(
|
BuildLineMapping(
|
||||||
documentAbsoluteIndex: 222,
|
documentAbsoluteIndex: 222,
|
||||||
documentLineIndex: 9,
|
documentLineIndex: 9,
|
||||||
documentCharacterOffsetIndex: 40,
|
documentCharacterOffsetIndex: 40,
|
||||||
generatedAbsoluteIndex: 2495,
|
generatedAbsoluteIndex: 2510,
|
||||||
generatedLineIndex: 62,
|
generatedLineIndex: 62,
|
||||||
generatedCharacterOffsetIndex: 102,
|
generatedCharacterOffsetIndex: 107,
|
||||||
contentLength: 7),
|
contentLength: 7),
|
||||||
BuildLineMapping(
|
BuildLineMapping(
|
||||||
documentAbsoluteIndex: 249,
|
documentAbsoluteIndex: 249,
|
||||||
documentLineIndex: 10,
|
documentLineIndex: 10,
|
||||||
documentCharacterOffsetIndex: 15,
|
documentCharacterOffsetIndex: 15,
|
||||||
generatedAbsoluteIndex: 2821,
|
generatedAbsoluteIndex: 2836,
|
||||||
generatedLineIndex: 69,
|
generatedLineIndex: 69,
|
||||||
generatedCharacterOffsetIndex: 39,
|
generatedCharacterOffsetIndex: 39,
|
||||||
contentLength: 9),
|
contentLength: 9),
|
||||||
|
|
@ -1864,7 +1864,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Generator
|
||||||
documentAbsoluteIndex: 272,
|
documentAbsoluteIndex: 272,
|
||||||
documentLineIndex: 10,
|
documentLineIndex: 10,
|
||||||
documentCharacterOffsetIndex: 38,
|
documentCharacterOffsetIndex: 38,
|
||||||
generatedAbsoluteIndex: 2943,
|
generatedAbsoluteIndex: 2958,
|
||||||
generatedLineIndex: 74,
|
generatedLineIndex: 74,
|
||||||
generatedCharacterOffsetIndex: 45,
|
generatedCharacterOffsetIndex: 45,
|
||||||
contentLength: 9),
|
contentLength: 9),
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ using Microsoft.AspNetCore.Razor.Chunks;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;
|
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;
|
||||||
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.TagHelpers;
|
using Microsoft.AspNetCore.Razor.Parser.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class CSharpTagHelperRenderingUnitTest
|
public class CSharpTagHelperRenderingUnitTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class CodeGenTestCodeGenerator : CSharpCodeGenerator
|
public class CodeGenTestCodeGenerator : CSharpCodeGenerator
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class CodeGenTestHost : RazorEngineHost
|
public class CodeGenTestHost : RazorEngineHost
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class LineMappingTest
|
public class LineMappingTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Microsoft.AspNetCore.Testing;
|
using Microsoft.AspNetCore.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public abstract class RazorCodeGeneratorTest<TLanguage>
|
public abstract class RazorCodeGeneratorTest<TLanguage>
|
||||||
where TLanguage : RazorCodeLanguage, new()
|
where TLanguage : RazorCodeLanguage, new()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum TabTest
|
public enum TabTest
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ using System;
|
||||||
#if NETCOREAPP1_0
|
#if NETCOREAPP1_0
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#endif
|
#endif
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;
|
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.CodeGenerators;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.CodeGenerators
|
||||||
{
|
{
|
||||||
public class TagHelperAttributeValueCodeRendererTest : TagHelperTestBase
|
public class TagHelperAttributeValueCodeRendererTest : TagHelperTestBase
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
using Microsoft.AspNetCore.Razor.CodeGenerators;
|
||||||
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;
|
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
|
using Microsoft.AspNetCore.Razor.Parser;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class TagHelperTestBase : RazorCodeGeneratorTest
|
public class TagHelperTestBase : CSharpRazorCodeGeneratorTest
|
||||||
{
|
{
|
||||||
protected void RunTagHelperTest(string testName,
|
protected void RunTagHelperTest(string testName,
|
||||||
string baseLineName = null,
|
string baseLineName = null,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Generator
|
namespace Microsoft.AspNetCore.Razor.Test.CodeGenerators
|
||||||
{
|
{
|
||||||
public class TestSpan
|
public class TestSpan
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Internal;
|
using Microsoft.AspNetCore.Razor.Test.Internal;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
@ -66,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Compilation.TagHelpers
|
||||||
$"\"{ nameof(TagHelperDescriptor.AllowedChildren) }\":[\"allowed child one\"]," +
|
$"\"{ nameof(TagHelperDescriptor.AllowedChildren) }\":[\"allowed child one\"]," +
|
||||||
$"\"{ nameof(TagHelperDescriptor.RequiredParent) }\":\"parent name\"," +
|
$"\"{ nameof(TagHelperDescriptor.RequiredParent) }\":\"parent name\"," +
|
||||||
$"\"{ nameof(TagHelperDescriptor.TagStructure) }\":0," +
|
$"\"{ nameof(TagHelperDescriptor.TagStructure) }\":0," +
|
||||||
$"\"{ nameof(TagHelperDescriptor.DesignTimeDescriptor) }\":{{"+
|
$"\"{ nameof(TagHelperDescriptor.DesignTimeDescriptor) }\":{{" +
|
||||||
$"\"{ nameof(TagHelperDesignTimeDescriptor.Summary) }\":\"usage summary\"," +
|
$"\"{ nameof(TagHelperDesignTimeDescriptor.Summary) }\":\"usage summary\"," +
|
||||||
$"\"{ nameof(TagHelperDesignTimeDescriptor.Remarks) }\":\"usage remarks\"," +
|
$"\"{ nameof(TagHelperDesignTimeDescriptor.Remarks) }\":\"usage remarks\"," +
|
||||||
$"\"{ nameof(TagHelperDesignTimeDescriptor.OutputElementHint) }\":\"some-tag\"}}}}";
|
$"\"{ nameof(TagHelperDesignTimeDescriptor.OutputElementHint) }\":\"some-tag\"}}}}";
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Parser.SyntaxTree
|
namespace Microsoft.AspNetCore.Razor.Editor
|
||||||
{
|
{
|
||||||
public class AutoCompleteEditHandlerTest
|
public class AutoCompleteEditHandlerTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Parser.SyntaxTree
|
namespace Microsoft.AspNetCore.Razor.Editor
|
||||||
{
|
{
|
||||||
public class ImplicitExpressionEditHandlerTest
|
public class ImplicitExpressionEditHandlerTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,255 +0,0 @@
|
||||||
// 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.Threading;
|
|
||||||
using System.Web.WebPages.TestUtils;
|
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Generator;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Utils;
|
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
|
||||||
using Microsoft.AspNetCore.Testing;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Editor
|
|
||||||
{
|
|
||||||
public class RazorEditorParserTest
|
|
||||||
{
|
|
||||||
private static readonly TestFile SimpleCSHTMLDocument = TestFile.Create("TestFiles/DesignTime/Simple.cshtml");
|
|
||||||
private static readonly TestFile SimpleCSHTMLDocumentGenerated = TestFile.Create("TestFiles/DesignTime/Simple.txt");
|
|
||||||
private const string TestLinePragmaFileName = "C:\\This\\Path\\Is\\Just\\For\\Line\\Pragmas.cshtml";
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void ConstructorRequiresNonNullPhysicalPath()
|
|
||||||
{
|
|
||||||
Assert.Throws<ArgumentException>("sourceFileName", () => new RazorEditorParser(CreateHost(), null));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void ConstructorRequiresNonEmptyPhysicalPath()
|
|
||||||
{
|
|
||||||
Assert.Throws<ArgumentException>("sourceFileName", () => new RazorEditorParser(CreateHost(), string.Empty));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(" ")]
|
|
||||||
[InlineData("\r\n")]
|
|
||||||
[InlineData("abcdefg")]
|
|
||||||
[InlineData("\f\r\n abcd \t")]
|
|
||||||
public void TreesAreDifferentReturnsFalseForAddedContent(string content)
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var factory = SpanFactory.CreateCsHtml();
|
|
||||||
var blockFactory = new BlockFactory(factory);
|
|
||||||
var original = new MarkupBlock(
|
|
||||||
blockFactory.MarkupTagBlock("<p>"),
|
|
||||||
blockFactory.TagHelperBlock(
|
|
||||||
tagName: "div",
|
|
||||||
tagMode: TagMode.StartTagAndEndTag,
|
|
||||||
start: new SourceLocation(3, 0, 3),
|
|
||||||
startTag: blockFactory.MarkupTagBlock("<div>"),
|
|
||||||
children: new SyntaxTreeNode[]
|
|
||||||
{
|
|
||||||
factory.Markup($"{Environment.NewLine}{Environment.NewLine}")
|
|
||||||
},
|
|
||||||
endTag: blockFactory.MarkupTagBlock("</div>")),
|
|
||||||
blockFactory.MarkupTagBlock("</p>"));
|
|
||||||
|
|
||||||
factory.Reset();
|
|
||||||
|
|
||||||
var modified = new MarkupBlock(
|
|
||||||
blockFactory.MarkupTagBlock("<p>"),
|
|
||||||
blockFactory.TagHelperBlock(
|
|
||||||
tagName: "div",
|
|
||||||
tagMode: TagMode.StartTagAndEndTag,
|
|
||||||
start: new SourceLocation(3, 0, 3),
|
|
||||||
startTag: blockFactory.MarkupTagBlock("<div>"),
|
|
||||||
children: new SyntaxTreeNode[]
|
|
||||||
{
|
|
||||||
factory.Markup($"{Environment.NewLine}{content}{Environment.NewLine}")
|
|
||||||
},
|
|
||||||
endTag: blockFactory.MarkupTagBlock("</div>")),
|
|
||||||
blockFactory.MarkupTagBlock("</p>"));
|
|
||||||
original.LinkNodes();
|
|
||||||
modified.LinkNodes();
|
|
||||||
|
|
||||||
var oldBuffer = new StringTextBuffer($"<p><div>{Environment.NewLine}{Environment.NewLine}</div></p>");
|
|
||||||
var newBuffer = new StringTextBuffer(
|
|
||||||
$"<p><div>{Environment.NewLine}{content}{Environment.NewLine}</div></p>");
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var treesAreDifferent = BackgroundParser.TreesAreDifferent(
|
|
||||||
original,
|
|
||||||
modified,
|
|
||||||
new[]
|
|
||||||
{
|
|
||||||
new TextChange(
|
|
||||||
position: 8 + Environment.NewLine.Length,
|
|
||||||
oldLength: 0,
|
|
||||||
oldBuffer: oldBuffer,
|
|
||||||
newLength: content.Length,
|
|
||||||
newBuffer: newBuffer)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.False(treesAreDifferent);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void TreesAreDifferentReturnsTrueIfTreeStructureIsDifferent()
|
|
||||||
{
|
|
||||||
var factory = SpanFactory.CreateCsHtml();
|
|
||||||
var original = new MarkupBlock(
|
|
||||||
factory.Markup("<p>"),
|
|
||||||
new ExpressionBlock(
|
|
||||||
factory.CodeTransition()),
|
|
||||||
factory.Markup("</p>"));
|
|
||||||
var modified = new MarkupBlock(
|
|
||||||
factory.Markup("<p>"),
|
|
||||||
new ExpressionBlock(
|
|
||||||
factory.CodeTransition("@"),
|
|
||||||
factory.Code("f")
|
|
||||||
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false)),
|
|
||||||
factory.Markup("</p>"));
|
|
||||||
var oldBuffer = new StringTextBuffer("<p>@</p>");
|
|
||||||
var newBuffer = new StringTextBuffer("<p>@f</p>");
|
|
||||||
Assert.True(BackgroundParser.TreesAreDifferent(
|
|
||||||
original,
|
|
||||||
modified,
|
|
||||||
new[]
|
|
||||||
{
|
|
||||||
new TextChange(position: 4, oldLength: 0, oldBuffer: oldBuffer, newLength: 1, newBuffer: newBuffer)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void TreesAreDifferentReturnsFalseIfTreeStructureIsSame()
|
|
||||||
{
|
|
||||||
var factory = SpanFactory.CreateCsHtml();
|
|
||||||
var original = new MarkupBlock(
|
|
||||||
factory.Markup("<p>"),
|
|
||||||
new ExpressionBlock(
|
|
||||||
factory.CodeTransition(),
|
|
||||||
factory.Code("f")
|
|
||||||
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false)),
|
|
||||||
factory.Markup("</p>"));
|
|
||||||
factory.Reset();
|
|
||||||
var modified = new MarkupBlock(
|
|
||||||
factory.Markup("<p>"),
|
|
||||||
new ExpressionBlock(
|
|
||||||
factory.CodeTransition(),
|
|
||||||
factory.Code("foo")
|
|
||||||
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false)),
|
|
||||||
factory.Markup("</p>"));
|
|
||||||
original.LinkNodes();
|
|
||||||
modified.LinkNodes();
|
|
||||||
var oldBuffer = new StringTextBuffer("<p>@f</p>");
|
|
||||||
var newBuffer = new StringTextBuffer("<p>@foo</p>");
|
|
||||||
Assert.False(BackgroundParser.TreesAreDifferent(
|
|
||||||
original,
|
|
||||||
modified,
|
|
||||||
new[]
|
|
||||||
{
|
|
||||||
new TextChange(position: 5, oldLength: 0, oldBuffer: oldBuffer, newLength: 2, newBuffer: newBuffer)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void CheckForStructureChangesRequiresNonNullBufferInChange()
|
|
||||||
{
|
|
||||||
var change = new TextChange();
|
|
||||||
var parameterName = "change";
|
|
||||||
var exception = Assert.Throws<ArgumentException>(
|
|
||||||
parameterName,
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
using (var parser = new RazorEditorParser(CreateHost(), "C:\\Foo.cshtml"))
|
|
||||||
{
|
|
||||||
parser.CheckForStructureChanges(change);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ExceptionHelpers.ValidateArgumentException(parameterName, RazorResources.FormatStructure_Member_CannotBeNull(nameof(change.NewBuffer), nameof(TextChange)), exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static RazorEngineHost CreateHost()
|
|
||||||
{
|
|
||||||
return new CodeGenTestHost(new CSharpRazorCodeLanguage()) { DesignTimeMode = true };
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[ReplaceCulture]
|
|
||||||
public void CheckForStructureChangesStartsReparseAndFiresDocumentParseCompletedEventIfNoAdditionalChangesQueued()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
using (var parser = CreateClientParser())
|
|
||||||
{
|
|
||||||
var input = new StringTextBuffer(SimpleCSHTMLDocument.ReadAllText());
|
|
||||||
|
|
||||||
DocumentParseCompleteEventArgs capturedArgs = null;
|
|
||||||
var parseComplete = new ManualResetEventSlim(false);
|
|
||||||
|
|
||||||
parser.DocumentParseComplete += (sender, args) =>
|
|
||||||
{
|
|
||||||
capturedArgs = args;
|
|
||||||
parseComplete.Set();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(string.Empty), input.Length, input));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
|
||||||
|
|
||||||
Assert.Equal(
|
|
||||||
SimpleCSHTMLDocumentGenerated.ReadAllText(),
|
|
||||||
capturedArgs.GeneratorResults.GeneratedCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void CheckForStructureChangesStartsFullReparseIfChangeOverlapsMultipleSpans()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
using (var parser = new RazorEditorParser(CreateHost(), TestLinePragmaFileName))
|
|
||||||
{
|
|
||||||
var original = new StringTextBuffer("Foo @bar Baz");
|
|
||||||
var changed = new StringTextBuffer("Foo @bap Daz");
|
|
||||||
var change = new TextChange(7, 3, original, 3, changed);
|
|
||||||
|
|
||||||
var parseComplete = new ManualResetEventSlim();
|
|
||||||
var parseCount = 0;
|
|
||||||
parser.DocumentParseComplete += (sender, args) =>
|
|
||||||
{
|
|
||||||
Interlocked.Increment(ref parseCount);
|
|
||||||
parseComplete.Set();
|
|
||||||
};
|
|
||||||
|
|
||||||
Assert.Equal(PartialParseResult.Rejected, parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(string.Empty), 12, original)));
|
|
||||||
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait); // Wait for the parse to finish
|
|
||||||
parseComplete.Reset();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var result = parser.CheckForStructureChanges(change);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(PartialParseResult.Rejected, result);
|
|
||||||
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
|
||||||
Assert.Equal(2, parseCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextChange CreateDummyChange()
|
|
||||||
{
|
|
||||||
return new TextChange(0, 0, new StringTextBuffer(string.Empty), 3, new StringTextBuffer("foo"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static RazorEditorParser CreateClientParser()
|
|
||||||
{
|
|
||||||
return new RazorEditorParser(CreateHost(), TestLinePragmaFileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Parser.SyntaxTree
|
namespace Microsoft.AspNetCore.Razor.Editor
|
||||||
{
|
{
|
||||||
public class SpanEditHandlerTest
|
public class SpanEditHandlerTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Framework
|
namespace Microsoft.AspNetCore.Razor.Test.Framework
|
||||||
{
|
{
|
||||||
internal class RawTextSymbol : ISymbol
|
public class RawTextSymbol : ISymbol
|
||||||
{
|
{
|
||||||
public SourceLocation Start { get; private set; }
|
public SourceLocation Start { get; private set; }
|
||||||
public string Content { get; }
|
public string Content { get; }
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpAutoCompleteTest : CsHtmlCodeParserTestBase
|
public class CSharpAutoCompleteTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
|
|
@ -11,7 +10,7 @@ using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpBlockTest : CsHtmlCodeParserTestBase
|
public class CSharpBlockTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -2,12 +2,11 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpDirectivesTest : CsHtmlCodeParserTestBase
|
public class CSharpDirectivesTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,12 +3,11 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpErrorTest : CsHtmlCodeParserTestBase
|
public class CSharpErrorTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpExplicitExpressionTest : CsHtmlCodeParserTestBase
|
public class CSharpExplicitExpressionTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -2,12 +2,11 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpImplicitExpressionTest : CsHtmlCodeParserTestBase
|
public class CSharpImplicitExpressionTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpNestedStatementsTest : CsHtmlCodeParserTestBase
|
public class CSharpNestedStatementsTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,14 +3,13 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpRazorCommentsTest : CsHtmlMarkupParserTestBase
|
public class CSharpRazorCommentsTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class CSharpReservedWordsTest : CsHtmlCodeParserTestBase
|
public class CSharpReservedWordsTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,14 +3,13 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class CSharpSectionTest : CsHtmlMarkupParserTestBase
|
public class CSharpSectionTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -2,12 +2,11 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class CSharpSpecialBlockTest : CsHtmlCodeParserTestBase
|
public class CSharpSpecialBlockTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,12 +3,11 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
// Basic Tests for C# Statements:
|
// Basic Tests for C# Statements:
|
||||||
// * Basic case for each statement
|
// * Basic case for each statement
|
||||||
|
|
@ -4,15 +4,13 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class CSharpTemplateTest : CsHtmlCodeParserTestBase
|
public class CSharpTemplateTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -2,16 +2,13 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpToMarkupSwitchTest : CsHtmlCodeParserTestBase
|
public class CSharpToMarkupSwitchTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -460,7 +457,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
||||||
Factory.Markup(Environment.NewLine).Accepts(AcceptedCharacters.None)
|
Factory.Markup(Environment.NewLine).Accepts(AcceptedCharacters.None)
|
||||||
),
|
),
|
||||||
Factory.Code(
|
Factory.Code(
|
||||||
$" return;{Environment.NewLine} case 2:{Environment.NewLine}"+
|
$" return;{Environment.NewLine} case 2:{Environment.NewLine}" +
|
||||||
" {" + Environment.NewLine).AsStatement(),
|
" {" + Environment.NewLine).AsStatement(),
|
||||||
new MarkupBlock(
|
new MarkupBlock(
|
||||||
Factory.Markup(" "),
|
Factory.Markup(" "),
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpVerbatimBlockTest : CsHtmlCodeParserTestBase
|
public class CSharpVerbatimBlockTest : CsHtmlCodeParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,14 +3,12 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.CSharp
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class CSharpWhitespaceHandlingTest : CsHtmlMarkupParserTestBase
|
public class CSharpWhitespaceHandlingTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Utils
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class DisposableActionTest
|
public class DisposableActionTest
|
||||||
{
|
{
|
||||||
|
|
@ -4,15 +4,14 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Parser.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class HtmlToCodeSwitchTest : CsHtmlMarkupParserTestBase
|
public class HtmlToCodeSwitchTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,15 +3,14 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class CallbackParserListenerTest
|
public class CallbackVisitorTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ListenerConstructedWithSpanCallbackCallsCallbackOnEndSpan()
|
public void ListenerConstructedWithSpanCallbackCallsCallbackOnEndSpan()
|
||||||
|
|
@ -4,14 +4,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class HtmlAttributeTest : CsHtmlMarkupParserTestBase
|
public class HtmlAttributeTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
|
|
@ -13,7 +11,7 @@ using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class HtmlBlockTest : CsHtmlMarkupParserTestBase
|
public class HtmlBlockTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -4,16 +4,15 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Editor;
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class HtmlDocumentTest : CsHtmlMarkupParserTestBase
|
public class HtmlDocumentTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class HtmlErrorTest : CsHtmlMarkupParserTestBase
|
public class HtmlErrorTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Parser;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Test.Parser.Internal
|
||||||
{
|
{
|
||||||
internal class HtmlParserTestUtils
|
internal class HtmlParserTestUtils
|
||||||
{
|
{
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.Html
|
namespace Microsoft.AspNetCore.Razor.Parser.Internal
|
||||||
{
|
{
|
||||||
public class HtmlTagsTest : CsHtmlMarkupParserTestBase
|
public class HtmlTagsTest : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class ParserContextTest
|
public class ParserContextTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,12 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class ParserVisitorExtensionsTest
|
public class ParserVisitorExtensionsTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
|
@ -14,7 +13,7 @@ using Moq;
|
||||||
using Moq.Protected;
|
using Moq.Protected;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class RazorParserTest
|
public class RazorParserTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,11 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.WebPages.TestUtils;
|
using System.Web.WebPages.TestUtils;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser
|
namespace Microsoft.AspNetCore.Razor.Parser.SyntaxTree
|
||||||
{
|
{
|
||||||
public class BlockTest
|
public class BlockTest
|
||||||
{
|
{
|
||||||
|
|
@ -6,16 +6,15 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Test.TagHelpers;
|
using Microsoft.AspNetCore.Razor.Test.Parser.TagHelpers.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Compilation.TagHelpers
|
namespace Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal
|
||||||
{
|
{
|
||||||
public class TagHelperBlockRewriterTest : TagHelperRewritingTestBase
|
public class TagHelperBlockRewriterTest : TagHelperRewritingTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -6,18 +6,16 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
using Microsoft.AspNetCore.Razor.Chunks.Generators;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
|
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Parser.TagHelpers.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.TagHelpers
|
namespace Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal
|
||||||
{
|
{
|
||||||
public class TagHelperParseTreeRewriterTest : TagHelperRewritingTestBase
|
public class TagHelperParseTreeRewriterTest : TagHelperRewritingTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -3,15 +3,14 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Parser;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal;
|
using Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.TagHelpers
|
namespace Microsoft.AspNetCore.Razor.Test.Parser.TagHelpers.Internal
|
||||||
{
|
{
|
||||||
public class TagHelperRewritingTestBase : CsHtmlMarkupParserTestBase
|
public class TagHelperRewritingTestBase : CsHtmlMarkupParserTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -4,16 +4,15 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Microsoft.Extensions.Internal;
|
using Microsoft.Extensions.Internal;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Compilation.TagHelpers
|
namespace Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal
|
||||||
{
|
{
|
||||||
public class TagHelperDirectiveSpanVisitorTest
|
public class TagHelperDirectiveSpanVisitorTest
|
||||||
{
|
{
|
||||||
|
|
@ -3,11 +3,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Text
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class TextReaderExtensionsTest
|
public class TextReaderExtensionsTest
|
||||||
{
|
{
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser
|
namespace Microsoft.AspNetCore.Razor.Parser
|
||||||
{
|
{
|
||||||
public class WhitespaceRewriterTest
|
public class WhitespaceRewriterTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.PartialParsing
|
namespace Microsoft.AspNetCore.Razor
|
||||||
{
|
{
|
||||||
public abstract class PartialParsingTestBase<TLanguage>
|
public abstract class PartialParsingTestBase<TLanguage>
|
||||||
where TLanguage : RazorCodeLanguage, new()
|
where TLanguage : RazorCodeLanguage, new()
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test
|
namespace Microsoft.AspNetCore.Razor
|
||||||
{
|
{
|
||||||
public class RazorCodeLanguageTest
|
public class RazorCodeLanguageTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,241 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Web.WebPages.TestUtils;
|
using System.Web.WebPages.TestUtils;
|
||||||
|
using Microsoft.AspNetCore.Razor.Editor;
|
||||||
using Microsoft.AspNetCore.Razor.Parser;
|
using Microsoft.AspNetCore.Razor.Parser;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
using Microsoft.AspNetCore.Razor.Parser.SyntaxTree;
|
||||||
|
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.CodeGenerators;
|
||||||
using Microsoft.AspNetCore.Razor.Test.Framework;
|
using Microsoft.AspNetCore.Razor.Test.Framework;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
|
using Microsoft.AspNetCore.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Parser.PartialParsing
|
namespace Microsoft.AspNetCore.Razor
|
||||||
{
|
{
|
||||||
public class CSharpPartialParsingTest : PartialParsingTestBase<CSharpRazorCodeLanguage>
|
public class RazorEditorParserTest : PartialParsingTestBase<CSharpRazorCodeLanguage>
|
||||||
{
|
{
|
||||||
|
private static readonly TestFile SimpleCSHTMLDocument = TestFile.Create("TestFiles/DesignTime/Simple.cshtml");
|
||||||
|
private static readonly TestFile SimpleCSHTMLDocumentGenerated = TestFile.Create("TestFiles/DesignTime/Simple.txt");
|
||||||
|
private const string TestLinePragmaFileName = "C:\\This\\Path\\Is\\Just\\For\\Line\\Pragmas.cshtml";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ConstructorRequiresNonNullPhysicalPath()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>("sourceFileName", () => new RazorEditorParser(CreateCodeGenTestHost(), null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ConstructorRequiresNonEmptyPhysicalPath()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>("sourceFileName", () => new RazorEditorParser(CreateCodeGenTestHost(), string.Empty));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\r\n")]
|
||||||
|
[InlineData("abcdefg")]
|
||||||
|
[InlineData("\f\r\n abcd \t")]
|
||||||
|
public void TreesAreDifferentReturnsFalseForAddedContent(string content)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var factory = SpanFactory.CreateCsHtml();
|
||||||
|
var blockFactory = new BlockFactory(factory);
|
||||||
|
var original = new MarkupBlock(
|
||||||
|
blockFactory.MarkupTagBlock("<p>"),
|
||||||
|
blockFactory.TagHelperBlock(
|
||||||
|
tagName: "div",
|
||||||
|
tagMode: TagMode.StartTagAndEndTag,
|
||||||
|
start: new SourceLocation(3, 0, 3),
|
||||||
|
startTag: blockFactory.MarkupTagBlock("<div>"),
|
||||||
|
children: new SyntaxTreeNode[]
|
||||||
|
{
|
||||||
|
factory.Markup($"{Environment.NewLine}{Environment.NewLine}")
|
||||||
|
},
|
||||||
|
endTag: blockFactory.MarkupTagBlock("</div>")),
|
||||||
|
blockFactory.MarkupTagBlock("</p>"));
|
||||||
|
|
||||||
|
factory.Reset();
|
||||||
|
|
||||||
|
var modified = new MarkupBlock(
|
||||||
|
blockFactory.MarkupTagBlock("<p>"),
|
||||||
|
blockFactory.TagHelperBlock(
|
||||||
|
tagName: "div",
|
||||||
|
tagMode: TagMode.StartTagAndEndTag,
|
||||||
|
start: new SourceLocation(3, 0, 3),
|
||||||
|
startTag: blockFactory.MarkupTagBlock("<div>"),
|
||||||
|
children: new SyntaxTreeNode[]
|
||||||
|
{
|
||||||
|
factory.Markup($"{Environment.NewLine}{content}{Environment.NewLine}")
|
||||||
|
},
|
||||||
|
endTag: blockFactory.MarkupTagBlock("</div>")),
|
||||||
|
blockFactory.MarkupTagBlock("</p>"));
|
||||||
|
original.LinkNodes();
|
||||||
|
modified.LinkNodes();
|
||||||
|
|
||||||
|
var oldBuffer = new StringTextBuffer($"<p><div>{Environment.NewLine}{Environment.NewLine}</div></p>");
|
||||||
|
var newBuffer = new StringTextBuffer(
|
||||||
|
$"<p><div>{Environment.NewLine}{content}{Environment.NewLine}</div></p>");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var treesAreDifferent = BackgroundParser.TreesAreDifferent(
|
||||||
|
original,
|
||||||
|
modified,
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new TextChange(
|
||||||
|
position: 8 + Environment.NewLine.Length,
|
||||||
|
oldLength: 0,
|
||||||
|
oldBuffer: oldBuffer,
|
||||||
|
newLength: content.Length,
|
||||||
|
newBuffer: newBuffer)
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.False(treesAreDifferent);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TreesAreDifferentReturnsTrueIfTreeStructureIsDifferent()
|
||||||
|
{
|
||||||
|
var factory = SpanFactory.CreateCsHtml();
|
||||||
|
var original = new MarkupBlock(
|
||||||
|
factory.Markup("<p>"),
|
||||||
|
new ExpressionBlock(
|
||||||
|
factory.CodeTransition()),
|
||||||
|
factory.Markup("</p>"));
|
||||||
|
var modified = new MarkupBlock(
|
||||||
|
factory.Markup("<p>"),
|
||||||
|
new ExpressionBlock(
|
||||||
|
factory.CodeTransition("@"),
|
||||||
|
factory.Code("f")
|
||||||
|
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false)),
|
||||||
|
factory.Markup("</p>"));
|
||||||
|
var oldBuffer = new StringTextBuffer("<p>@</p>");
|
||||||
|
var newBuffer = new StringTextBuffer("<p>@f</p>");
|
||||||
|
Assert.True(BackgroundParser.TreesAreDifferent(
|
||||||
|
original,
|
||||||
|
modified,
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new TextChange(position: 4, oldLength: 0, oldBuffer: oldBuffer, newLength: 1, newBuffer: newBuffer)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TreesAreDifferentReturnsFalseIfTreeStructureIsSame()
|
||||||
|
{
|
||||||
|
var factory = SpanFactory.CreateCsHtml();
|
||||||
|
var original = new MarkupBlock(
|
||||||
|
factory.Markup("<p>"),
|
||||||
|
new ExpressionBlock(
|
||||||
|
factory.CodeTransition(),
|
||||||
|
factory.Code("f")
|
||||||
|
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false)),
|
||||||
|
factory.Markup("</p>"));
|
||||||
|
factory.Reset();
|
||||||
|
var modified = new MarkupBlock(
|
||||||
|
factory.Markup("<p>"),
|
||||||
|
new ExpressionBlock(
|
||||||
|
factory.CodeTransition(),
|
||||||
|
factory.Code("foo")
|
||||||
|
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false)),
|
||||||
|
factory.Markup("</p>"));
|
||||||
|
original.LinkNodes();
|
||||||
|
modified.LinkNodes();
|
||||||
|
var oldBuffer = new StringTextBuffer("<p>@f</p>");
|
||||||
|
var newBuffer = new StringTextBuffer("<p>@foo</p>");
|
||||||
|
Assert.False(BackgroundParser.TreesAreDifferent(
|
||||||
|
original,
|
||||||
|
modified,
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
new TextChange(position: 5, oldLength: 0, oldBuffer: oldBuffer, newLength: 2, newBuffer: newBuffer)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CheckForStructureChangesRequiresNonNullBufferInChange()
|
||||||
|
{
|
||||||
|
var change = new TextChange();
|
||||||
|
var parameterName = "change";
|
||||||
|
var exception = Assert.Throws<ArgumentException>(
|
||||||
|
parameterName,
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
using (var parser = new RazorEditorParser(CreateCodeGenTestHost(), "C:\\Foo.cshtml"))
|
||||||
|
{
|
||||||
|
parser.CheckForStructureChanges(change);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ExceptionHelpers.ValidateArgumentException(parameterName, RazorResources.FormatStructure_Member_CannotBeNull(nameof(change.NewBuffer), nameof(TextChange)), exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[ReplaceCulture]
|
||||||
|
public void CheckForStructureChangesStartsReparseAndFiresDocumentParseCompletedEventIfNoAdditionalChangesQueued()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
using (var parser = new RazorEditorParser(CreateCodeGenTestHost(), TestLinePragmaFileName))
|
||||||
|
{
|
||||||
|
var input = new StringTextBuffer(SimpleCSHTMLDocument.ReadAllText());
|
||||||
|
|
||||||
|
DocumentParseCompleteEventArgs capturedArgs = null;
|
||||||
|
var parseComplete = new ManualResetEventSlim(false);
|
||||||
|
|
||||||
|
parser.DocumentParseComplete += (sender, args) =>
|
||||||
|
{
|
||||||
|
capturedArgs = args;
|
||||||
|
parseComplete.Set();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(string.Empty), input.Length, input));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
||||||
|
|
||||||
|
Assert.Equal(
|
||||||
|
SimpleCSHTMLDocumentGenerated.ReadAllText(),
|
||||||
|
capturedArgs.GeneratorResults.GeneratedCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CheckForStructureChangesStartsFullReparseIfChangeOverlapsMultipleSpans()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
using (var parser = new RazorEditorParser(CreateHost(), TestLinePragmaFileName))
|
||||||
|
{
|
||||||
|
var original = new StringTextBuffer("Foo @bar Baz");
|
||||||
|
var changed = new StringTextBuffer("Foo @bap Daz");
|
||||||
|
var change = new TextChange(7, 3, original, 3, changed);
|
||||||
|
|
||||||
|
var parseComplete = new ManualResetEventSlim();
|
||||||
|
var parseCount = 0;
|
||||||
|
parser.DocumentParseComplete += (sender, args) =>
|
||||||
|
{
|
||||||
|
Interlocked.Increment(ref parseCount);
|
||||||
|
parseComplete.Set();
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.Equal(PartialParseResult.Rejected, parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(string.Empty), 12, original)));
|
||||||
|
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait); // Wait for the parse to finish
|
||||||
|
parseComplete.Reset();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = parser.CheckForStructureChanges(change);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(PartialParseResult.Rejected, result);
|
||||||
|
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
||||||
|
Assert.Equal(2, parseCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void AwaitPeriodInsertionAcceptedProvisionally()
|
public void AwaitPeriodInsertionAcceptedProvisionally()
|
||||||
{
|
{
|
||||||
|
|
@ -669,5 +893,10 @@ namespace Microsoft.AspNetCore.Razor.Test.Parser.PartialParsing
|
||||||
{
|
{
|
||||||
RunTypeKeywordTest("class");
|
RunTypeKeywordTest("class");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static RazorEngineHost CreateCodeGenTestHost()
|
||||||
|
{
|
||||||
|
return new CodeGenTestHost(new CSharpRazorCodeLanguage()) { DesignTimeMode = true };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Razor.Parser;
|
||||||
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
using Microsoft.AspNetCore.Razor.Parser.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test
|
namespace Microsoft.AspNetCore.Razor
|
||||||
{
|
{
|
||||||
public class RazorEngineHostTest
|
public class RazorEngineHostTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test
|
namespace Microsoft.AspNetCore.Razor
|
||||||
{
|
{
|
||||||
public class RazorTemplateEngineTest
|
public class RazorTemplateEngineTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,19 @@ __TestNamespace_InputTagHelper.Value = MyEnum.MyValue;
|
||||||
__TestNamespace_InputTagHelper = CreateTagHelper<global::TestNamespace.InputTagHelper>();
|
__TestNamespace_InputTagHelper = CreateTagHelper<global::TestNamespace.InputTagHelper>();
|
||||||
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
||||||
#line 9 "EnumTagHelpers.cshtml"
|
#line 9 "EnumTagHelpers.cshtml"
|
||||||
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MyValue;
|
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.CodeGenerators.MyEnum.MyValue;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
__TestNamespace_InputTagHelper = CreateTagHelper<global::TestNamespace.InputTagHelper>();
|
__TestNamespace_InputTagHelper = CreateTagHelper<global::TestNamespace.InputTagHelper>();
|
||||||
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
||||||
#line 10 "EnumTagHelpers.cshtml"
|
#line 10 "EnumTagHelpers.cshtml"
|
||||||
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MySecondValue;
|
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.CodeGenerators.MyEnum.MySecondValue;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
#line 10 "EnumTagHelpers.cshtml"
|
#line 10 "EnumTagHelpers.cshtml"
|
||||||
__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MyValue;
|
__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Test.CodeGenerators.MyEnum.MyValue;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ AddHtmlAttributeValue("", 128, MyEnum.MySecondValue, 128, 21, false);
|
||||||
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
||||||
__tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper);
|
__tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper);
|
||||||
#line 9 "EnumTagHelpers.cshtml"
|
#line 9 "EnumTagHelpers.cshtml"
|
||||||
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MyValue;
|
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.CodeGenerators.MyEnum.MyValue;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
@ -110,13 +110,13 @@ __TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.G
|
||||||
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
__TestNamespace_CatchAllTagHelper = CreateTagHelper<global::TestNamespace.CatchAllTagHelper>();
|
||||||
__tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper);
|
__tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper);
|
||||||
#line 10 "EnumTagHelpers.cshtml"
|
#line 10 "EnumTagHelpers.cshtml"
|
||||||
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MySecondValue;
|
__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Test.CodeGenerators.MyEnum.MySecondValue;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
__tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
|
__tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
|
||||||
#line 10 "EnumTagHelpers.cshtml"
|
#line 10 "EnumTagHelpers.cshtml"
|
||||||
__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MyValue;
|
__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Test.CodeGenerators.MyEnum.MyValue;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Text
|
namespace Microsoft.AspNetCore.Razor.Text
|
||||||
{
|
{
|
||||||
public class LineTrackingStringBufferTest
|
public class LineTrackingStringBufferTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Text
|
namespace Microsoft.AspNetCore.Razor.Text
|
||||||
{
|
{
|
||||||
public abstract class LookaheadTextReaderTestBase
|
public abstract class LookaheadTextReaderTestBase
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Text
|
namespace Microsoft.AspNetCore.Razor.Text
|
||||||
{
|
{
|
||||||
public class SourceLocationTrackerTest
|
public class SourceLocationTrackerTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Web.WebPages.TestUtils;
|
using System.Web.WebPages.TestUtils;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Test.Utils;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Text
|
namespace Microsoft.AspNetCore.Razor.Text
|
||||||
{
|
{
|
||||||
public class TextChangeTest
|
public class TextChangeTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class CSharpTokenizerCommentTest : CSharpTokenizerTestBase
|
public class CSharpTokenizerCommentTest : CSharpTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class CSharpTokenizerIdentifierTest : CSharpTokenizerTestBase
|
public class CSharpTokenizerIdentifierTest : CSharpTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class CSharpTokenizerLiteralTest : CSharpTokenizerTestBase
|
public class CSharpTokenizerLiteralTest : CSharpTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class CSharpTokenizerOperatorsTest : CSharpTokenizerTestBase
|
public class CSharpTokenizerOperatorsTest : CSharpTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class CSharpTokenizerTest : CSharpTokenizerTestBase
|
public class CSharpTokenizerTest : CSharpTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Tokenizer;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public abstract class CSharpTokenizerTestBase : TokenizerTestBase<CSharpSymbol, CSharpSymbolType>
|
public abstract class CSharpTokenizerTestBase : TokenizerTestBase<CSharpSymbol, CSharpSymbolType>
|
||||||
{
|
{
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class HtmlTokenizerTest : HtmlTokenizerTestBase
|
public class HtmlTokenizerTest : HtmlTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Razor.Tokenizer;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public abstract class HtmlTokenizerTestBase : TokenizerTestBase<HtmlSymbol, HtmlSymbolType>
|
public abstract class HtmlTokenizerTestBase : TokenizerTestBase<HtmlSymbol, HtmlSymbolType>
|
||||||
{
|
{
|
||||||
|
|
@ -5,14 +5,13 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Microsoft.AspNetCore.Razor.Test.Tokenizer.Internal;
|
||||||
using Microsoft.AspNetCore.Razor.Text;
|
using Microsoft.AspNetCore.Razor.Text;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Internal;
|
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols;
|
||||||
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
using Microsoft.AspNetCore.Razor.Tokenizer.Symbols.Internal;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test.Tokenizer
|
namespace Microsoft.AspNetCore.Razor.Tokenizer.Internal
|
||||||
{
|
{
|
||||||
public class TokenizerLookaheadTest : HtmlTokenizerTestBase
|
public class TokenizerLookaheadTest : HtmlTokenizerTestBase
|
||||||
{
|
{
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test
|
namespace Microsoft.AspNetCore.Razor.Test.Utils
|
||||||
{
|
{
|
||||||
public static class ExceptionHelpers
|
public static class ExceptionHelpers
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Test
|
namespace Microsoft.AspNetCore.Razor.Test.Utils
|
||||||
{
|
{
|
||||||
public class TestFile
|
public class TestFile
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue