diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultDirectiveIRPassTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultDirectiveIRPassTest.cs index 8df52b874d..3e05843f80 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultDirectiveIRPassTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/DefaultDirectiveIRPassTest.cs @@ -40,8 +40,15 @@ namespace Microsoft.AspNetCore.Razor.Evolution var irDocument = pass.Execute(codeDocument: null, irDocument: originalIRDocument); // Assert - var @namespace = SingleChild(irDocument); - var @class = SingleChild(@namespace); + Children(irDocument, + node => Assert.IsType(node), + node => Assert.IsType(node)); + var @namespace = irDocument.Children[1]; + Children(@namespace, + node => Assert.IsType(node), + node => Assert.IsType(node), + node => Assert.IsType(node)); + var @class = (ClassDeclarationIRNode)@namespace.Children[2]; Assert.Equal(@class.BaseType, "Hello"); } @@ -57,8 +64,15 @@ namespace Microsoft.AspNetCore.Razor.Evolution var irDocument = pass.Execute(codeDocument: null, irDocument: originalIRDocument); // Assert - var @namespace = SingleChild(irDocument); - var @class = SingleChild(@namespace); + Children(irDocument, + node => Assert.IsType(node), + node => Assert.IsType(node)); + var @namespace = irDocument.Children[1]; + Children(@namespace, + node => Assert.IsType(node), + node => Assert.IsType(node), + node => Assert.IsType(node)); + var @class = @namespace.Children[2]; Children(@class, node => Assert.IsType(node), node => CSharpStatement(" var value = true; ", node)); diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/BasicIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/BasicIntegrationTest.cs index d0e71d70e2..80b517d15d 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/BasicIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/BasicIntegrationTest.cs @@ -72,36 +72,5 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests Assert.NotNull(document.GetSyntaxTree()); Assert.NotNull(document.GetIRDocument()); } - - [Fact] - public void Process_CustomDirective() - { - // Arrange - var engine = RazorEngine.Create(b => - { - b.AddDirective(DirectiveDescriptorBuilder.Create("test_directive").Build()); - }); - - var document = RazorCodeDocument.Create(TestRazorSourceDocument.Create("@test_directive")); - - // Act - engine.Process(document); - - // Assert - var syntaxTree = document.GetSyntaxTree(); - - // This is fragile for now, but we don't want to invest in the legacy API until we're ready - // to replace it properly. - var directiveBlock = (Block)syntaxTree.Root.Children[1]; - var directiveSpan = (Span)directiveBlock.Children[1]; - Assert.Equal("test_directive", directiveSpan.Content); - - var irDocument = document.GetIRDocument(); - var irNamespace = irDocument.Children[1]; - var irClass = irNamespace.Children[2]; - var irMethod = irClass.Children[0]; - var irDirective = (DirectiveIRNode)irMethod.Children[1]; - Assert.Equal("test_directive", irDirective.Name); - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs index 8e7d0f6b4f..7ef9650441 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs @@ -109,5 +109,36 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests var baseline = testFile.ReadAllText().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); RazorIRNodeVerifier.Verify(document, baseline); } + + protected void AssertCSharpDocumentMatchesBaseline(RazorCSharpDocument document) + { + if (Filename == null) + { + var message = $"{nameof(AssertCSharpDocumentMatchesBaseline)} should only be called from an integration test ({nameof(Filename)} is null)."; + throw new InvalidOperationException(message); + } + + var baselineFilename = Path.ChangeExtension(Filename, ".codegen.cs"); + + if (GenerateBaselines) + { + var baselineFullPath = Path.Combine(TestProjectRoot, baselineFilename); + File.WriteAllText(baselineFullPath, document.GeneratedCode); + return; + } + + var testFile = TestFile.Create(baselineFilename); + if (!testFile.Exists()) + { + throw new XunitException($"The resource {baselineFilename} was not found."); + } + + var baseline = testFile.ReadAllText(); + + // Normalize newlines to match those in the baseline. + var actual = document.GeneratedCode.Replace("\r", "").Replace("\n", "\r\n"); + + Assert.Equal(baseline, actual); + } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RazorIRNodeWriter.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RazorIRNodeWriter.cs index a4e2ccf151..5f3856ace8 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RazorIRNodeWriter.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RazorIRNodeWriter.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using Microsoft.AspNetCore.Razor.Evolution.Intermediate; namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests @@ -145,7 +146,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests { if (node.SourceRange != null) { - _writer.Write(node.SourceRange.ToString()); + var sourceRange = node.SourceRange; + _writer.Write("("); + _writer.Write(sourceRange.AbsoluteIndex); + _writer.Write(":"); + _writer.Write(sourceRange.LineIndex); + _writer.Write(","); + _writer.Write(sourceRange.CharacterIndex); + _writer.Write(" ["); + _writer.Write(sourceRange.ContentLength); + _writer.Write("] "); + + var fileName = sourceRange.FilePath.Substring(sourceRange.FilePath.LastIndexOf('/') + 1); + _writer.Write(fileName); + _writer.Write(")"); } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs new file mode 100644 index 0000000000..7484c4d1dd --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs @@ -0,0 +1,601 @@ +// 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.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests +{ + public class RuntimeCodeGenerationIntegrationTest : IntegrationTestBase + { + [Fact] + public void UnfinishedExpressionInCode() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Templates() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void StringLiterals() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void SimpleUnspacedIf() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Sections() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void RazorComments() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ParserError() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void OpenedIf() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NullConditionalExpressions() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NoLinePragmas() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NestedCSharp() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NestedCodeBlocks() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void MarkupInCodeBlock() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Instrumented() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void InlineBlocks() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Inherits() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Imports() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ImplicitExpressionAtEOF() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ImplicitExpression() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void HtmlCommentWithQuote_Double() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void HtmlCommentWithQuote_Single() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void HiddenSpansInCode() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void FunctionsBlock() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void FunctionsBlockMinimal() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExpressionsInCode() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExplicitExpressionWithMarkup() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExplicitExpressionAtEOF() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExplicitExpression() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyImplicitExpressionInCode() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyImplicitExpression() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyExplicitExpression() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyCodeBlock() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void DesignTime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ConditionalAttributes() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void CodeBlockWithTextElement() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void CodeBlockAtEOF() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void CodeBlock() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Blocks() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Await() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + private class ApiSetsIRTestAdapter : IRazorIRPass + { + public RazorEngine Engine { get; set; } + + public int Order { get; set; } + + public DocumentIRNode Execute(RazorCodeDocument codeDocument, DocumentIRNode irDocument) + { + var walker = new ApiSetsIRWalker(); + walker.Visit(irDocument); + + return irDocument; + } + + private class ApiSetsIRWalker : RazorIRNodeWalker + { + public override void VisitClass(ClassDeclarationIRNode node) + { + node.Name = Filename.Replace('/', '_'); + node.AccessModifier = "public"; + + VisitDefault(node); + } + + public override void VisitNamespace(NamespaceDeclarationIRNode node) + { + node.Content = typeof(RuntimeCodeGenerationIntegrationTest).Namespace + ".TestFiles"; + + VisitDefault(node); + } + + public override void VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node) + { + node.AccessModifier = "public"; + node.Modifiers = new[] { "async" }; + node.ReturnType = typeof(Task).FullName; + node.Name = "ExecuteAsync"; + + VisitDefault(node); + } + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.ir.txt index 3f064ee5b9..b096fef432 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.ir.txt @@ -5,6 +5,6 @@ Document - UsingStatement - - System.Threading.Tasks ClassDeclaration - - - - - RazorMethodDeclaration - - - - - - HtmlContent - (0:0,0 [0] TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.cshtml) - + HtmlContent - (0:0,0 [0] CustomDirective.cshtml) - Directive - - test_directive - HtmlContent - (15:0,15 [0] TestFiles/IntegrationTests/BasicIntegrationTest/CustomDirective.cshtml) - + HtmlContent - (15:0,15 [0] CustomDirective.cshtml) - diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/Empty.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/Empty.ir.txt index 14b78633dc..937bd6b428 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/Empty.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/Empty.ir.txt @@ -5,4 +5,4 @@ Document - UsingStatement - - System.Threading.Tasks ClassDeclaration - - - - - RazorMethodDeclaration - - - - - - HtmlContent - (0:0,0 [0] TestFiles/IntegrationTests/BasicIntegrationTest/Empty.cshtml) - + HtmlContent - (0:0,0 [0] Empty.cshtml) - diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/HelloWorld.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/HelloWorld.ir.txt index 8a90797f4b..d998af149e 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/HelloWorld.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/BasicIntegrationTest/HelloWorld.ir.txt @@ -5,4 +5,4 @@ Document - UsingStatement - - System.Threading.Tasks ClassDeclaration - - - - - RazorMethodDeclaration - - - - - - HtmlContent - (0:0,0 [13] TestFiles/IntegrationTests/BasicIntegrationTest/HelloWorld.cshtml) - Hello, World! + HtmlContent - (0:0,0 [13] HelloWorld.cshtml) - Hello, World! diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithConditionalAttribute.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithConditionalAttribute.ir.txt index b353920f6b..5126896a1f 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithConditionalAttribute.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithConditionalAttribute.ir.txt @@ -1,10 +1,13 @@ Document - + Checksum - NamespaceDeclaration - - + UsingStatement - - System + UsingStatement - - System.Threading.Tasks ClassDeclaration - - - - - RazorMethodDeclaration - - - - - - HtmlContent - (0:0,0 [6] ) - \n\n \n\n" + HtmlContent - (0:0,0 [6] HtmlWithConditionalAttribute.cshtml) - \n\n \n\n" diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithDataDashAttribute.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithDataDashAttribute.ir.txt index 2ada8eee97..693abac537 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithDataDashAttribute.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/HtmlAttributeIntegrationTest/HtmlWithDataDashAttribute.ir.txt @@ -1,8 +1,11 @@ Document - + Checksum - NamespaceDeclaration - - + UsingStatement - - System + UsingStatement - - System.Threading.Tasks ClassDeclaration - - - - - RazorMethodDeclaration - - - - - - HtmlContent - (0:0,0 [6] ) - \n\n \n\n" + HtmlContent - (0:0,0 [6] HtmlWithDataDashAttribute.cshtml) - \n\n \n\n" diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.codegen.cs new file mode 100644 index 0000000000..ba09e1e112 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.codegen.cs @@ -0,0 +1,100 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "00b5e01b7a405dcfde7e4d512ee930daaa1778b5" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Await + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n
\r\n

Basic Asynchronous Expression Test

\r\n

Basic Asynchronous Expression: "); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo()); + +#line default +#line hidden + WriteLiteral("

\r\n

Basic Asynchronous Template: "); +#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo()); + +#line default +#line hidden + WriteLiteral("

\r\n

Basic Asynchronous Statement: "); +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + await Foo(); + +#line default +#line hidden + WriteLiteral("

\r\n

Basic Asynchronous Statement Nested: "); +#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo()); + +#line default +#line hidden + WriteLiteral(" "); + WriteLiteral("

\r\n

Basic Incomplete Asynchronous Statement: "); +#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await); + +#line default +#line hidden + WriteLiteral("

\r\n
\r\n\r\n
\r\n

Advanced Asynchronous Expression Test

\r\n

Advanced Asynchronous Expression: "); +#line 19 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo(1, 2)); + +#line default +#line hidden + WriteLiteral("

\r\n

Advanced Asynchronous Expression Extended: "); +#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo.Bar(1, 2)); + +#line default +#line hidden + WriteLiteral("

\r\n

Advanced Asynchronous Template: "); +#line 21 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo("bob", true)); + +#line default +#line hidden + WriteLiteral("

\r\n

Advanced Asynchronous Statement: "); +#line 22 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + await Foo(something, hello: "world"); + +#line default +#line hidden + WriteLiteral("

\r\n

Advanced Asynchronous Statement Extended: "); +#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + await Foo.Bar(1, 2) + +#line default +#line hidden + WriteLiteral("

\r\n

Advanced Asynchronous Statement Nested: "); +#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await Foo(boolValue: false)); + +#line default +#line hidden + WriteLiteral(" "); + WriteLiteral("

\r\n

Advanced Incomplete Asynchronous Statement: "); +#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + Write(await ("wrrronggg")); + +#line default +#line hidden + WriteLiteral("

\r\n
"); + } + #pragma warning restore 1998 +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" + + public async Task Foo() + { + return "Bar"; + } + + +#line default +#line hidden + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml new file mode 100644 index 0000000000..69b68e07c5 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml @@ -0,0 +1,26 @@ +@functions { + public async Task Foo() + { + return "Bar"; + } +} + +
+

Basic Asynchronous Expression Test

+

Basic Asynchronous Expression: @await Foo()

+

Basic Asynchronous Template: @(await Foo())

+

Basic Asynchronous Statement: @{ await Foo(); }

+

Basic Asynchronous Statement Nested: @{ @await Foo() }

+

Basic Incomplete Asynchronous Statement: @await

+
+ +
+

Advanced Asynchronous Expression Test

+

Advanced Asynchronous Expression: @await Foo(1, 2)

+

Advanced Asynchronous Expression Extended: @await Foo.Bar(1, 2)

+

Advanced Asynchronous Template: @(await Foo("bob", true))

+

Advanced Asynchronous Statement: @{ await Foo(something, hello: "world"); }

+

Advanced Asynchronous Statement Extended: @{ await Foo.Bar(1, 2) }

+

Advanced Asynchronous Statement Nested: @{ @await Foo(boolValue: false) }

+

Advanced Incomplete Asynchronous Statement: @await ("wrrronggg")

+
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs new file mode 100644 index 0000000000..36233ed55d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs @@ -0,0 +1,147 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ba7d8f5f5159a2389c780aa606885ef6c917a45a" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Blocks + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + + int i = 1; + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + while(i <= 10) { + + +#line default +#line hidden + WriteLiteral("

Hello from C#, #"); +#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + Write(i); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + i += 1; +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + if(i == 11) { + + +#line default +#line hidden + WriteLiteral("

We wrote 10 lines!

\r\n"); +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + switch(i) { + case 11: + + +#line default +#line hidden + WriteLiteral("

No really, we wrote 10 lines!

\r\n"); +#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + break; + default: + + +#line default +#line hidden + WriteLiteral("

Actually, we didn\'t...

\r\n"); +#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + break; +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + for(int j = 1; j <= 10; j += 2) { + + +#line default +#line hidden + WriteLiteral("

Hello again from C#, #"); +#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + Write(j); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + try { + + +#line default +#line hidden + WriteLiteral("

That time, we wrote 5 lines!

\r\n"); +#line 29 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +} catch(Exception ex) { + + +#line default +#line hidden + WriteLiteral("

Oh no! An error occurred: "); +#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + Write(ex.Message); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 31 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n

i is now "); +#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + Write(i); + +#line default +#line hidden + WriteLiteral("

\r\n\r\n"); +#line 35 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" + lock(new object()) { + + +#line default +#line hidden + WriteLiteral("

This block is locked, for your security!

\r\n"); +#line 37 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml new file mode 100644 index 0000000000..8d27de89cc --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml @@ -0,0 +1,37 @@ +@{ + int i = 1; +} + +@while(i <= 10) { +

Hello from C#, #@(i)

+ i += 1; +} + +@if(i == 11) { +

We wrote 10 lines!

+} + +@switch(i) { + case 11: +

No really, we wrote 10 lines!

+ break; + default: +

Actually, we didn't...

+ break; +} + +@for(int j = 1; j <= 10; j += 2) { +

Hello again from C#, #@(j)

+} + +@try { +

That time, we wrote 5 lines!

+} catch(Exception ex) { +

Oh no! An error occurred: @(ex.Message)

+} + +

i is now @i

+ +@lock(new object()) { +

This block is locked, for your security!

+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs new file mode 100644 index 0000000000..8e917bebc8 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs @@ -0,0 +1,24 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "019ce8023d064d08ca88c597b764aea895ec5841" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlock + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml" + + for(int i = 1; i <= 10; i++) { + Output.Write("

Hello from C#, #" + i.ToString() + "

"); + } + + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml new file mode 100644 index 0000000000..1c78883a10 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml @@ -0,0 +1,5 @@ +@{ + for(int i = 1; i <= 10; i++) { + Output.Write("

Hello from C#, #" + i.ToString() + "

"); + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs new file mode 100644 index 0000000000..959a3cc74b --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs @@ -0,0 +1,15 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5f82673b13daf5e28291f3bfb58df5e3a94e13cc" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlockAtEOF + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml new file mode 100644 index 0000000000..38417d481c --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml @@ -0,0 +1 @@ +@{ \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.codegen.cs new file mode 100644 index 0000000000..ce4255bb1a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.codegen.cs @@ -0,0 +1,34 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "13e48ff59aab8106ceb68dd4a10b0bdf10c322fc" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlockWithTextElement + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + var a = 1; + +#line default +#line hidden + WriteLiteral("foo"); +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + var b = 1; + +#line default +#line hidden + WriteLiteral("bar "); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + Write(a+b); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml new file mode 100644 index 0000000000..9c34a940eb --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml @@ -0,0 +1,4 @@ +@{ + var a = 1; foo + var b = 1; bar @(a+b) +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs new file mode 100644 index 0000000000..33b1e6cb50 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs @@ -0,0 +1,104 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "088be4e50958bcab0f1d1ac04d2c28dcd8049bf5" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ConditionalAttributes + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + var ch = true; + var cls = "bar"; + + +#line default +#line hidden + WriteLiteral(" \r\n \r\n +

+

+

+ + +

+ + + + +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.codegen.cs new file mode 100644 index 0000000000..d90e829afd --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.codegen.cs @@ -0,0 +1,67 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "fa44b61006e587564a67bc785a9beeb41425a016" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_DesignTime + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("

\r\n\r\n

\r\n"); +#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml" +Write(Foo(Bar.Baz)); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml" +Write(Foo(item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, "

Bar "); +#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml" +WriteTo(__razor_template_writer, baz); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, " Biz

"); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n

\r\n\r\n"); + DefineSection("Footer", async(__razor_section_writer) => { + WriteLiteralTo(__razor_section_writer, "\r\n

Foo

\r\n "); +#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml" +WriteTo(__razor_section_writer, bar); + +#line default +#line hidden + WriteLiteralTo(__razor_section_writer, "\r\n"); + } + ); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml new file mode 100644 index 0000000000..5dcaeebdbf --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.cshtml @@ -0,0 +1,15 @@ +
+ @for(int i = 1; i <= 10; i++) { +

This is item #@i

+ } +
+ +

+@(Foo(Bar.Baz)) +@Foo(@

Bar @baz Biz

) +

+ +@section Footer { +

Foo

+ @bar +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.codegen.cs new file mode 100644 index 0000000000..3d29805762 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.codegen.cs @@ -0,0 +1,16 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a81f9de6dc302ab6600f3808428e5247ed389511" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyCodeBlock + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("This is markup\r\n\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.cshtml new file mode 100644 index 0000000000..0366199cd5 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.cshtml @@ -0,0 +1,3 @@ +This is markup + +@{} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.codegen.cs new file mode 100644 index 0000000000..609aba05c2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.codegen.cs @@ -0,0 +1,21 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e6467906896d16277c5a0cf962ac6d863c58852f" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyExplicitExpression + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("This is markup\r\n\r\n"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" +Write(); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml new file mode 100644 index 0000000000..6790c7eba2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml @@ -0,0 +1,3 @@ +This is markup + +@() \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.codegen.cs new file mode 100644 index 0000000000..cae55a6785 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.codegen.cs @@ -0,0 +1,22 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8ed47ba5d7cac644fdbb2c4f816d49bdeed1ac45" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyImplicitExpression + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("This is markup\r\n\r\n"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" +Write(); + +#line default +#line hidden + WriteLiteral("!"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml new file mode 100644 index 0000000000..021306da6b --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml @@ -0,0 +1,3 @@ +This is markup + +@! \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.codegen.cs new file mode 100644 index 0000000000..404d0aa7fe --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.codegen.cs @@ -0,0 +1,20 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b21853e37dde51b305bde9602624934d4d6affd3" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_EmptyImplicitExpressionInCode + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" +Write(); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml new file mode 100644 index 0000000000..a1db8cd602 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml @@ -0,0 +1,3 @@ +@{ + @ +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.codegen.cs new file mode 100644 index 0000000000..71864062a5 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.codegen.cs @@ -0,0 +1,21 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a897a227b26c531d644bdff988df46d3c8178346" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExplicitExpression + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("1 + 1 = "); +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml" + Write(1+1); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml new file mode 100644 index 0000000000..10730f1114 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpression.cshtml @@ -0,0 +1 @@ +1 + 1 = @(1+1) \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.codegen.cs new file mode 100644 index 0000000000..bf308f8910 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.codegen.cs @@ -0,0 +1,21 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "bf53afff8ab65f1af9b9a82f9a571f1cd023dfc0" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExplicitExpressionAtEOF + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("This is markup\r\n\r\n"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" +Write(); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml new file mode 100644 index 0000000000..a0fdfc9a21 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml @@ -0,0 +1,3 @@ +This is markup + +@( \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.codegen.cs new file mode 100644 index 0000000000..2250d9cf27 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.codegen.cs @@ -0,0 +1,24 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1252c799cdeb86a71e4304f01ebaae540fa26894" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExplicitExpressionWithMarkup + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("
"); +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml" + Write(item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, "
"); +} +)); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml new file mode 100644 index 0000000000..70d8cefd95 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml @@ -0,0 +1 @@ +
@(@
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.codegen.cs new file mode 100644 index 0000000000..a6cde378c0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.codegen.cs @@ -0,0 +1,69 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8c7ae67489dbddec9f2dbef3c2b65def1149e507" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ExpressionsInCode + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" + + object foo = null; + string bar = "Foo"; + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" + if(foo != null) { + + +#line default +#line hidden +#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" +Write(foo); + +#line default +#line hidden +#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" + +} else { + + +#line default +#line hidden + WriteLiteral("

Foo is Null!

\r\n"); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n

\r\n"); +#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" + if(!String.IsNullOrEmpty(bar)) { + + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" +Write(bar.Replace("F", "B")); + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml" + +} + + +#line default +#line hidden + WriteLiteral("

"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml new file mode 100644 index 0000000000..a4d4caa007 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.cshtml @@ -0,0 +1,16 @@ +@{ + object foo = null; + string bar = "Foo"; +} + +@if(foo != null) { + @foo +} else { +

Foo is Null!

+} + +

+@if(!String.IsNullOrEmpty(bar)) { + @(bar.Replace("F", "B")) +} +

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.codegen.cs new file mode 100644 index 0000000000..a7f441c527 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.codegen.cs @@ -0,0 +1,32 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "94813053694a285515d791c48d703f1131881d0c" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_FunctionsBlock + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + WriteLiteral("\r\nHere\'s a random number: "); +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml" + Write(RandomInt()); + +#line default +#line hidden + } + #pragma warning restore 1998 +#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml" + + Random _rand = new Random(); + private int RandomInt() { + return _rand.Next(); + } + + +#line default +#line hidden + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml new file mode 100644 index 0000000000..5d06b37224 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlock.cshtml @@ -0,0 +1,12 @@ +@functions { + +} + +@functions { + Random _rand = new Random(); + private int RandomInt() { + return _rand.Next(); + } +} + +Here's a random number: @RandomInt() \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.codegen.cs new file mode 100644 index 0000000000..9d02f2034e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.codegen.cs @@ -0,0 +1,25 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "366e1cb1c026413435ec398a7d47c8c1acc373d8" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_FunctionsBlockMinimal + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n\r\n"); + } + #pragma warning restore 1998 +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml" + +string foo(string input) { + return input + "!"; +} + + +#line default +#line hidden + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml new file mode 100644 index 0000000000..6b3de50b2c --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml @@ -0,0 +1,7 @@ + + + @functions{ +string foo(string input) { + return input + "!"; +} +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.codegen.cs new file mode 100644 index 0000000000..cf459f15fd --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.codegen.cs @@ -0,0 +1,21 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5bd51d8947ca920e594be8d214b4ebee2888c90c" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_HiddenSpansInCode + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml" + @Da + + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml new file mode 100644 index 0000000000..a6addbe97c --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.cshtml @@ -0,0 +1,3 @@ +@{ + @@Da +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.codegen.cs new file mode 100644 index 0000000000..1bd9070b4e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.codegen.cs @@ -0,0 +1,16 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a07711bc1fd0478b3b8329a68ab2028ef93429df" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_HtmlCommentWithQuote_Double + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml new file mode 100644 index 0000000000..6a99437910 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.codegen.cs new file mode 100644 index 0000000000..9fafc6f897 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.codegen.cs @@ -0,0 +1,16 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2d9bb4407e7aac9563aaeac9f0534a48f54e3d44" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_HtmlCommentWithQuote_Single + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml new file mode 100644 index 0000000000..dc1b21a546 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.codegen.cs new file mode 100644 index 0000000000..b732c8fca0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.codegen.cs @@ -0,0 +1,33 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "77befd9645f3c2d9ab48b935faebf9f731f42abc" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ImplicitExpression + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml" + for(int i = 1; i <= 10; i++) { + + +#line default +#line hidden + WriteLiteral("

This is item #"); +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml" + Write(i); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml" +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml new file mode 100644 index 0000000000..dcce7fa572 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.cshtml @@ -0,0 +1,3 @@ +@for(int i = 1; i <= 10; i++) { +

This is item #@i

+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.codegen.cs new file mode 100644 index 0000000000..da2534b682 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.codegen.cs @@ -0,0 +1,21 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ecf286733e30e006a630f3a5fe87c21f45e4c807" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ImplicitExpressionAtEOF + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("This is markup\r\n\r\n"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" +Write(); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml new file mode 100644 index 0000000000..365d20e003 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml @@ -0,0 +1,3 @@ +This is markup + +@ \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.codegen.cs new file mode 100644 index 0000000000..e43c978b38 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.codegen.cs @@ -0,0 +1,33 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f452adb7c255f6d9d6d2573c6add7cb28022b151" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + using System.IO; + using Foo = System.Text.Encoding; + using static System; + using static System.Console; + using static global::System.Text.Encoding; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Imports + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n\r\n

Path\'s full type name is "); +#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml" + Write(typeof(Path).FullName); + +#line default +#line hidden + WriteLiteral("

\r\n

Foo\'s actual full type name is "); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml" + Write(typeof(Foo).FullName); + +#line default +#line hidden + WriteLiteral("

"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml new file mode 100644 index 0000000000..90b2ae8222 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Imports.cshtml @@ -0,0 +1,10 @@ +@using System.IO +@using Foo = System.Text.Encoding +@using System + +@using static System +@using static System.Console +@using static global::System.Text.Encoding + +

Path's full type name is @typeof(Path).FullName

+

Foo's actual full type name is @typeof(Foo).FullName

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.codegen.cs new file mode 100644 index 0000000000..13192e13f3 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.codegen.cs @@ -0,0 +1,22 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "72d6e21c6366f99a17c63abebb46db3470f4d1da" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Inherits : foo.bar>.boz + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml" +Write(foo()); + +#line default +#line hidden + WriteLiteral("\r\n\r\n"); + WriteLiteral("bar\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml new file mode 100644 index 0000000000..b449937d8d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Inherits.cshtml @@ -0,0 +1,3 @@ +@foo() + +@inherits foo.bar>.boz bar diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.codegen.cs new file mode 100644 index 0000000000..1fd7e79869 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.codegen.cs @@ -0,0 +1,46 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e827e93343a95c7254a19287b095dfba9390d29f" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_InlineBlocks + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + DefineSection("Link", async(__razor_section_writer) => { + } + ); + WriteLiteral("(string link) {\r\n { +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml" + if(link != null) { + +#line default +#line hidden +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml" +WriteTo(__razor_attribute_value_writer, link); + +#line default +#line hidden +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml" + } else { + +#line default +#line hidden + WriteLiteralTo(__razor_attribute_value_writer, "#"); +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml" + } + +#line default +#line hidden + } + ), 43, 50, false); + EndWriteAttribute(); + WriteLiteral(" />\r\n}"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml new file mode 100644 index 0000000000..2a4ba7216f --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/InlineBlocks.cshtml @@ -0,0 +1,3 @@ +@section Link(string link) { +
+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.codegen.cs new file mode 100644 index 0000000000..a02a60ed55 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.codegen.cs @@ -0,0 +1,152 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9b521264e3e64710635c0f0490a368845d90da66" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Instrumented + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + + int i = 1; + var foo = + +#line default +#line hidden + item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, "

Bar

"); + } + ) +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + ; + + +#line default +#line hidden + WriteLiteral(" Hello, World\r\n

Hello, World

\r\n"); + WriteLiteral("\r\n"); +#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + while(i <= 10) { + + +#line default +#line hidden + WriteLiteral("

Hello from C#, #"); +#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + Write(i); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + i += 1; +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + if(i == 11) { + + +#line default +#line hidden + WriteLiteral("

We wrote 10 lines!

\r\n"); +#line 15 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + switch(i) { + case 11: + + +#line default +#line hidden + WriteLiteral("

No really, we wrote 10 lines!

\r\n"); +#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + break; + default: + + +#line default +#line hidden + WriteLiteral("

Actually, we didn\'t...

\r\n"); +#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + break; +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 26 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + for(int j = 1; j <= 10; j += 2) { + + +#line default +#line hidden + WriteLiteral("

Hello again from C#, #"); +#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + Write(j); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 28 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + try { + + +#line default +#line hidden + WriteLiteral("

That time, we wrote 5 lines!

\r\n"); +#line 32 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" +} catch(Exception ex) { + + +#line default +#line hidden + WriteLiteral("

Oh no! An error occurred: "); +#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + Write(ex.Message); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 34 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 36 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" + lock(new object()) { + + +#line default +#line hidden + WriteLiteral("

This block is locked, for your security!

\r\n"); +#line 38 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml" +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml new file mode 100644 index 0000000000..bd273c57e1 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Instrumented.cshtml @@ -0,0 +1,38 @@ +@{ + int i = 1; + var foo = @

Bar

; + @:Hello, World +

Hello, World

+} + +@while(i <= 10) { +

Hello from C#, #@(i)

+ i += 1; +} + +@if(i == 11) { +

We wrote 10 lines!

+} + +@switch(i) { + case 11: +

No really, we wrote 10 lines!

+ break; + default: +

Actually, we didn't...

+ break; +} + +@for(int j = 1; j <= 10; j += 2) { +

Hello again from C#, #@(j)

+} + +@try { +

That time, we wrote 5 lines!

+} catch(Exception ex) { +

Oh no! An error occurred: @(ex.Message)

+} + +@lock(new object()) { +

This block is locked, for your security!

+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.codegen.cs new file mode 100644 index 0000000000..cadef32cad --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.codegen.cs @@ -0,0 +1,35 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "cf059b36d7e93e260c1d5b852f7a59e6c99ae33d" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_MarkupInCodeBlock + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" + + for(int i = 1; i <= 10; i++) { + + +#line default +#line hidden + WriteLiteral("

Hello from C#, #"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" + Write(i.ToString()); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" + } + + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml new file mode 100644 index 0000000000..712ef42848 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml @@ -0,0 +1,5 @@ +@{ + for(int i = 1; i <= 10; i++) { +

Hello from C#, #@(i.ToString())

+ } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.codegen.cs new file mode 100644 index 0000000000..77163704f1 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.codegen.cs @@ -0,0 +1,34 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2b9e8dcf7c08153c15ac84973938a7c0254f2369" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NestedCSharp + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml" + foreach (var result in (dynamic)Url) + { + + +#line default +#line hidden + WriteLiteral("
\r\n "); +#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml" + Write(result.SomeValue); + +#line default +#line hidden + WriteLiteral(".\r\n
\r\n"); +#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml" + } + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml new file mode 100644 index 0000000000..8387e8a28a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCSharp.cshtml @@ -0,0 +1,8 @@ +@{ + @foreach (var result in (dynamic)Url) + { +
+ @result.SomeValue. +
+ } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.codegen.cs new file mode 100644 index 0000000000..9dfc4c5595 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.codegen.cs @@ -0,0 +1,33 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a4eb7397719094ea9da5b7d6674d317314fa26b4" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NestedCodeBlocks + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" + if(foo) { + + +#line default +#line hidden +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" + if(bar) { + } + +#line default +#line hidden +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" + +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml new file mode 100644 index 0000000000..070875f5fa --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.cshtml @@ -0,0 +1,4 @@ +@if(foo) { + @if(bar) { + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.codegen.cs new file mode 100644 index 0000000000..a04be8657f --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.codegen.cs @@ -0,0 +1,148 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "682929a2038f56f4737f1b7aa3c9eaa5488cc001" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NoLinePragmas + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + + int i = 1; + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + while(i <= 10) { + + +#line default +#line hidden + WriteLiteral("

Hello from C#, #"); +#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + Write(i); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + i += 1; +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + if(i == 11) { + + +#line default +#line hidden + WriteLiteral("

We wrote 10 lines!

\r\n"); +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + switch(i) { + case 11: + + +#line default +#line hidden + WriteLiteral("

No really, we wrote 10 lines!

\r\n"); +#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + break; + default: + + +#line default +#line hidden + WriteLiteral("

Actually, we didn\'t...

\r\n"); +#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + break; +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + for(int j = 1; j <= 10; j += 2) { + + +#line default +#line hidden + WriteLiteral("

Hello again from C#, #"); +#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + Write(j); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" +} + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + try { + + +#line default +#line hidden + WriteLiteral("

That time, we wrote 5 lines!

\r\n"); +#line 29 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" +} catch(Exception ex) { + + +#line default +#line hidden + WriteLiteral("

Oh no! An error occurred: "); +#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + Write(ex.Message); + +#line default +#line hidden + WriteLiteral("

\r\n"); +#line 31 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" +} + + + +#line default +#line hidden + WriteLiteral("

i is now "); +#line 34 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + Write(i); + +#line default +#line hidden + WriteLiteral("

\r\n\r\n"); +#line 36 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" + lock(new object()) { + + +#line default +#line hidden + WriteLiteral("

This block is locked, for your security!

\r\n"); +#line 38 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml" +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml new file mode 100644 index 0000000000..36e96c46b9 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NoLinePragmas.cshtml @@ -0,0 +1,38 @@ +@{ + int i = 1; +} + +@while(i <= 10) { +

Hello from C#, #@(i)

+ i += 1; +} + +@if(i == 11) { +

We wrote 10 lines!

+} + +@switch(i) { + case 11: +

No really, we wrote 10 lines!

+ break; + default: +

Actually, we didn't...

+ break; +} + +@for(int j = 1; j <= 10; j += 2) { +

Hello again from C#, #@(j)

+} + +@try { +

That time, we wrote 5 lines!

+} catch(Exception ex) { +

Oh no! An error occurred: @(ex.Message)

+} + +@* With has no equivalent in C# *@ +

i is now @i

+ +@lock(new object()) { +

This block is locked, for your security!

+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.codegen.cs new file mode 100644 index 0000000000..7c167a10fc --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.codegen.cs @@ -0,0 +1,59 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "c8c4f34e0768aea12ef6ce8e3fe0e384ad023faf" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_NullConditionalExpressions + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag?.Data); + +#line default +#line hidden +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag.IntIndexer?[0]); + +#line default +#line hidden +#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag.StrIndexer?["key"]); + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag?.Method(Value?[23]?.More)?["key"]); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 8 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag?.Data); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 9 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag.IntIndexer?[0]); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag.StrIndexer?["key"]); + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" +Write(ViewBag?.Method(Value?[23]?.More)?["key"]); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml new file mode 100644 index 0000000000..fa87620317 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.cshtml @@ -0,0 +1,11 @@ +@{ + @ViewBag?.Data + @ViewBag.IntIndexer?[0] + @ViewBag.StrIndexer?["key"] + @ViewBag?.Method(Value?[23]?.More)?["key"] +} + +@ViewBag?.Data +@ViewBag.IntIndexer?[0] +@ViewBag.StrIndexer?["key"] +@ViewBag?.Method(Value?[23]?.More)?["key"] \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.codegen.cs new file mode 100644 index 0000000000..0d43b162e2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.codegen.cs @@ -0,0 +1,23 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "608d7aa10b6df6798d8259379837fa7ffb088ed6" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_OpenedIf + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n\r\n"); +#line 3 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml" + if (true) { + + +#line default +#line hidden + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml new file mode 100644 index 0000000000..33162eb90b --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/OpenedIf.cshtml @@ -0,0 +1,5 @@ + + +@if (true) { + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.codegen.cs new file mode 100644 index 0000000000..3b29647f37 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.codegen.cs @@ -0,0 +1,24 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "99e6be6b384d3f247935d3cb15564542b7a82e43" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ParserError + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml" + +/* +int i =10; +int j =20; +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml new file mode 100644 index 0000000000..ab30e853fd --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ParserError.cshtml @@ -0,0 +1,5 @@ +@{ +/* +int i =10; +int j =20; +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.codegen.cs new file mode 100644 index 0000000000..49b5e86971 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.codegen.cs @@ -0,0 +1,50 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "45c16f152aef80d7de27c7df32dc522af5842197" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_RazorComments + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n

This should be shown

\r\n\r\n"); +#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" + + Exception foo = + +#line default +#line hidden +#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" + null; + if(foo != null) { + throw foo; + } + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" + var bar = "@* bar *@"; + +#line default +#line hidden + WriteLiteral("

But this should show the comment syntax: "); +#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" + Write(bar); + +#line default +#line hidden + WriteLiteral("

\r\n\r\n"); +#line 15 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml" +Write(ab); + +#line default +#line hidden + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml new file mode 100644 index 0000000000..bd4820f914 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/RazorComments.cshtml @@ -0,0 +1,15 @@ +@*This is not going to be rendered*@ +

This should @* not *@ be shown

+ +@{ + @* throw new Exception("Oh no!") *@ + Exception foo = @* new Exception("Oh no!") *@ null; + if(foo != null) { + throw foo; + } +} + +@{ var bar = "@* bar *@"; } +

But this should show the comment syntax: @bar

+ +@(a@**@b) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.codegen.cs new file mode 100644 index 0000000000..b60fd24b14 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.codegen.cs @@ -0,0 +1,66 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ec9a74381c339244a887565526c11056ece494a3" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Sections + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml" + + Layout = "_SectionTestLayout.cshtml" + + +#line default +#line hidden + WriteLiteral("\r\n
This is in the Body>\r\n\r\n"); + DefineSection("Section2", async(__razor_section_writer) => { + WriteLiteralTo(__razor_section_writer, "\r\n
\r\n"); + } + ); + WriteLiteral("\r\n"); + DefineSection("Section1", async(__razor_section_writer) => { + WriteLiteralTo(__razor_section_writer, "\r\n
This is in Section 1
\r\n"); + } + ); + WriteLiteral("\r\n"); + DefineSection("NestedDelegates", async(__razor_section_writer) => { + WriteLiteralTo(__razor_section_writer, "\r\n"); +#line 16 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml" + Func f = + +#line default +#line hidden + item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, ""); +#line 16 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml" + WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, ""); + } + ) +#line 16 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml" + ; + +#line default +#line hidden + } + ); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml new file mode 100644 index 0000000000..952461002f --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Sections.cshtml @@ -0,0 +1,17 @@ +@{ + Layout = "_SectionTestLayout.cshtml" +} + +
This is in the Body> + +@section Section2 { +
This is in Section 2
+} + +@section Section1 { +
This is in Section 1
+} + +@section NestedDelegates { + @{ Func f = @@item; } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.codegen.cs new file mode 100644 index 0000000000..c8bb5d6a75 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.codegen.cs @@ -0,0 +1,28 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8501407d5716c727ebc0ba157b04442cd2c302ff" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_SimpleUnspacedIf + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml" + if (true) +{ + + +#line default +#line hidden + WriteLiteral("\t
\r\n"); +#line 4 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml" +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml new file mode 100644 index 0000000000..27f2750eb2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml @@ -0,0 +1,4 @@ +@if (true) +{ +
+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.codegen.cs new file mode 100644 index 0000000000..939f4189c5 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.codegen.cs @@ -0,0 +1,264 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3c21118a6113e76e4f71d17e3ae081f13d451427" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_StringLiterals + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral(@"

This is line 1

+

This is line 2

+

This is line 3

+

This is line 4

+

This is line 5

+

This is line 6

+

This is line 7

+

This is line 8

+

This is line 9

+

This is line 10

+

This is line 11

+

This is line 12

+

This is line 13

+

This is line 14

+

This is line 15

+

This is line 16

+

This is line 17

+

This is line 18

+

This is line 19

+

This is line 20

+

This is line 21

+

This is line 22

+

This is line 23

+

This is line 24

+

This is line 25

+

This is line 26

+

This is line 27

+

This is line 28

+

This is line 29

+

This is line 30

+

This is line 31

+

This is line 32

+

This is line 33

+

This is line 34

+

This is line 35

+

This is line 36

+

This is line 37

+

This is line 38

+

This is line 39

+

This is line 40

+

This is line 41

+

This is line 42

+

This is line 43

+<"); + WriteLiteral(@"p>This is line 44

+

This is line 45

+

This is line 46

+

This is line 47

+

This is line 48

+

This is line 49

+

This is line 50

+

This is line 51

+

This is line 52

+

This is line 53

+

This is line 54

+

This is line 55

+

This is line 56

+

This is line 57

+

This is line 58

+

This is line 59

+

This is line 60

+

This is line 61

+

This is line 62

+

This is line 63

+

This is line 64

+

This is line 65

+

This is line 66

+

This is line 67

+

This is line 68

+

This is line 69

+

This is line 70

+

This is line 71

+

This is line 72

+

This is line 73

+

This is line 74

+

This is line 75

+

This is line 76

+

This is line 77

+

This is line 78

+

This is line 79

+

This is line 80

+

This is line 81

+

This is line 82

+

This is line 83

+

This is line 84


+ +"); + DefineSection("WriteLiteralsToInHere", async(__razor_section_writer) => { + WriteLiteralTo(__razor_section_writer, @" +

This is line 1 nested

+

This is line 2 nested

+

This is line 3 nested

+

This is line 4 nested

+

This is line 5 nested

+

This is line 6 nested

+

This is line 7 nested

+

This is line 8 nested

+

This is line 9 nested

+

This is line 10 nested

+

This is line 11 nested

+

This is line 12 nested

+

This is line 13 nested

+

This is line 14 nested

+

This is line 15 nested

+

This is line 16 nested

+

This is line 17 nested

+

This is line 18 nested

+

This is line 19 nested

+

This is line 20 nested

+

This is line 21 nested

+

This is line 22 nested

+

This is line 23 nested

+

This is line 24 nested

+

This is line 25 nested

+

This is line 26 nested

+

This is line 27 nested

+

This is line 28 nested

+

This is line 29 nested

+

This is l"); + WriteLiteralTo(__razor_section_writer, @"ine 30 nested

+

This is line 31 nested

+

This is line 32 nested

+

This is line 33 nested

+

This is line 34 nested

+

This is line 35 nested

+

This is line 36 nested

+

This is line 37 nested

+

This is line 38 nested

+

This is line 39 nested

+

This is line 40 nested

+

This is line 41 nested

+

This is line 42 nested

+

This is line 43 nested

+

This is line 44 nested

+

This is line 45 nested

+

This is line 46 nested

+

This is line 47 nested

+

This is line 48 nested

+

This is line 49 nested

+

This is line 50 nested

+

This is line 51 nested

+

This is line 52 nested

+

This is line 53 nested

+

This is line 54 nested

+

This is line 55 nested

+

This is line 56 nested

+

This is line 57 nested

+

This is line 58 nested

+

This is line 59 ne"); + WriteLiteralTo(__razor_section_writer, @"sted

+

This is line 60 nested

+

This is line 61 nested

+

This is line 62 nested

+

This is line 63 nested

+

This is line 64 nested

+

This is line 65 nested

+

This is line 66 nested

+

This is line 67 nested

+

This is line 68 nested

+

This is line 69 nested

+

This is line 70 nested

+

This is line 71 nested

+

This is line 72 nested

+

This is line 73 nested

+

This is line 74 nested

+

This is line 75 nested

+"); + } + ); + WriteLiteral(@"

This is line 1

+

This is line 2

+

This is line 3

+

This is line 4

+

This is line 5

+

This is line 6

+

This is line 7

+

This is line 8

+

This is line 9

+

This is line 10

+

This is line 11

+

This is line 12

+

This is line 13

+

This is line 14

+

This is line 15

+

This is line 16

+

This is line 17

+

This is line 18

+

This is line 19

+

This is line 20

+

This is line 21

+

This is line 22

+

This is line 23

+

This is line 24

+

This is line 25

+

This is line 26

+

This is line 27

+

This is line 28

+

This is line 29

+

This is line 30

+

This is line 31

+

This is line 32

+

This is line 33

+

This is line 34

+

This is line 35

+

This is line 36

+

This is line 37

+

This is line 38

+

This is line 39

+

This is line 40

+

This is line 41

+

This is line 42

+

This is line 43

hi!"); + WriteLiteral("\r\n"); + DefineSection("WriteLiteralsToInHereAlso", async(__razor_section_writer) => { + WriteLiteralTo(__razor_section_writer, @" +

This is line 1 nested

+

This is line 2 nested

+

This is line 3 nested

+

This is line 4 nested

+

This is line 5 nested

+

This is line 6 nested

+

This is line 7 nested

+

This is line 8 nested

+

This is line 9 nested

+

This is line 10 nested

+

This is line 11 nested

+

This is line 12 nested

+

This is line 13 nested

+

This is line 14 nested

+

This is line 15 nested

+

This is line 16 nested

+

This is line 17 nested

+

This is line 18 nested

+

This is line 19 nested

+

This is line 20 nested

+

This is line 21 nested

+

This is line 22 nested

+

This is line 23 nested

+

This is line 24 nested

+

This is line 25 nested

+

This is line 26 nested

+

This is line 27 nested

+

This is line 28 nested

+

This is line 29 nested

+

30

+"); + } + ); + WriteLiteral("!"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.cshtml new file mode 100644 index 0000000000..19d498abfe --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/StringLiterals.cshtml @@ -0,0 +1,237 @@ +

This is line 1

+

This is line 2

+

This is line 3

+

This is line 4

+

This is line 5

+

This is line 6

+

This is line 7

+

This is line 8

+

This is line 9

+

This is line 10

+

This is line 11

+

This is line 12

+

This is line 13

+

This is line 14

+

This is line 15

+

This is line 16

+

This is line 17

+

This is line 18

+

This is line 19

+

This is line 20

+

This is line 21

+

This is line 22

+

This is line 23

+

This is line 24

+

This is line 25

+

This is line 26

+

This is line 27

+

This is line 28

+

This is line 29

+

This is line 30

+

This is line 31

+

This is line 32

+

This is line 33

+

This is line 34

+

This is line 35

+

This is line 36

+

This is line 37

+

This is line 38

+

This is line 39

+

This is line 40

+

This is line 41

+

This is line 42

+

This is line 43

+

This is line 44

+

This is line 45

+

This is line 46

+

This is line 47

+

This is line 48

+

This is line 49

+

This is line 50

+

This is line 51

+

This is line 52

+

This is line 53

+

This is line 54

+

This is line 55

+

This is line 56

+

This is line 57

+

This is line 58

+

This is line 59

+

This is line 60

+

This is line 61

+

This is line 62

+

This is line 63

+

This is line 64

+

This is line 65

+

This is line 66

+

This is line 67

+

This is line 68

+

This is line 69

+

This is line 70

+

This is line 71

+

This is line 72

+

This is line 73

+

This is line 74

+

This is line 75

+

This is line 76

+

This is line 77

+

This is line 78

+

This is line 79

+

This is line 80

+

This is line 81

+

This is line 82

+

This is line 83

+

This is line 84


+ +@section WriteLiteralsToInHere { +

This is line 1 nested

+

This is line 2 nested

+

This is line 3 nested

+

This is line 4 nested

+

This is line 5 nested

+

This is line 6 nested

+

This is line 7 nested

+

This is line 8 nested

+

This is line 9 nested

+

This is line 10 nested

+

This is line 11 nested

+

This is line 12 nested

+

This is line 13 nested

+

This is line 14 nested

+

This is line 15 nested

+

This is line 16 nested

+

This is line 17 nested

+

This is line 18 nested

+

This is line 19 nested

+

This is line 20 nested

+

This is line 21 nested

+

This is line 22 nested

+

This is line 23 nested

+

This is line 24 nested

+

This is line 25 nested

+

This is line 26 nested

+

This is line 27 nested

+

This is line 28 nested

+

This is line 29 nested

+

This is line 30 nested

+

This is line 31 nested

+

This is line 32 nested

+

This is line 33 nested

+

This is line 34 nested

+

This is line 35 nested

+

This is line 36 nested

+

This is line 37 nested

+

This is line 38 nested

+

This is line 39 nested

+

This is line 40 nested

+

This is line 41 nested

+

This is line 42 nested

+

This is line 43 nested

+

This is line 44 nested

+

This is line 45 nested

+

This is line 46 nested

+

This is line 47 nested

+

This is line 48 nested

+

This is line 49 nested

+

This is line 50 nested

+

This is line 51 nested

+

This is line 52 nested

+

This is line 53 nested

+

This is line 54 nested

+

This is line 55 nested

+

This is line 56 nested

+

This is line 57 nested

+

This is line 58 nested

+

This is line 59 nested

+

This is line 60 nested

+

This is line 61 nested

+

This is line 62 nested

+

This is line 63 nested

+

This is line 64 nested

+

This is line 65 nested

+

This is line 66 nested

+

This is line 67 nested

+

This is line 68 nested

+

This is line 69 nested

+

This is line 70 nested

+

This is line 71 nested

+

This is line 72 nested

+

This is line 73 nested

+

This is line 74 nested

+

This is line 75 nested

+} +

This is line 1

+

This is line 2

+

This is line 3

+

This is line 4

+

This is line 5

+

This is line 6

+

This is line 7

+

This is line 8

+

This is line 9

+

This is line 10

+

This is line 11

+

This is line 12

+

This is line 13

+

This is line 14

+

This is line 15

+

This is line 16

+

This is line 17

+

This is line 18

+

This is line 19

+

This is line 20

+

This is line 21

+

This is line 22

+

This is line 23

+

This is line 24

+

This is line 25

+

This is line 26

+

This is line 27

+

This is line 28

+

This is line 29

+

This is line 30

+

This is line 31

+

This is line 32

+

This is line 33

+

This is line 34

+

This is line 35

+

This is line 36

+

This is line 37

+

This is line 38

+

This is line 39

+

This is line 40

+

This is line 41

+

This is line 42

+

This is line 43

hi! +@section WriteLiteralsToInHereAlso { +

This is line 1 nested

+

This is line 2 nested

+

This is line 3 nested

+

This is line 4 nested

+

This is line 5 nested

+

This is line 6 nested

+

This is line 7 nested

+

This is line 8 nested

+

This is line 9 nested

+

This is line 10 nested

+

This is line 11 nested

+

This is line 12 nested

+

This is line 13 nested

+

This is line 14 nested

+

This is line 15 nested

+

This is line 16 nested

+

This is line 17 nested

+

This is line 18 nested

+

This is line 19 nested

+

This is line 20 nested

+

This is line 21 nested

+

This is line 22 nested

+

This is line 23 nested

+

This is line 24 nested

+

This is line 25 nested

+

This is line 26 nested

+

This is line 27 nested

+

This is line 28 nested

+

This is line 29 nested

+

30

+}! \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.codegen.cs new file mode 100644 index 0000000000..da4abda9b7 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.codegen.cs @@ -0,0 +1,141 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ecd19ba0b3ae7ac597e19534c93fd2023208ae59" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Templates + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); +#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" + + Func foo = + +#line default +#line hidden + item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, "This works "); +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" + WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, "!"); + } + ) +#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" + ; + + +#line default +#line hidden +#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +Write(foo("")); + +#line default +#line hidden + WriteLiteral("\r\n
    \r\n"); +#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +Write(Repeat(10, item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, "
  • Item #"); +#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, "
  • "); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n
\r\n\r\n

\r\n"); +#line 21 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +Write(Repeat(10, + item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, " This is line#"); +#line 22 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, " of markup
\r\n"); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n

\r\n\r\n

\r\n"); +#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +Write(Repeat(10, + item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, ": This is line#"); +#line 28 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, " of markup
\r\n"); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n

\r\n\r\n

\r\n"); +#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +Write(Repeat(10, + item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, ":: This is line#"); +#line 34 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, " of markup
\r\n"); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n

\r\n\r\n\r\n
    \r\n "); +#line 40 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +Write(Repeat(10, item => new HelperResult(async(__razor_template_writer) => { + WriteLiteralTo(__razor_template_writer, "
  • \r\n Item #"); +#line 41 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" +WriteTo(__razor_template_writer, item); + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, "\r\n"); +#line 42 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" + var parent = item; + +#line default +#line hidden + WriteLiteralTo(__razor_template_writer, "
      \r\n
    • Child Items... ?
    • \r\n
    \r\n
  • "); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n
"); + } + #pragma warning restore 1998 +#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml" + + public HelperResult Repeat(int times, Func template) { + return new HelperResult((writer) => { + for(int i = 0; i < times; i++) { + ((HelperResult)template(i)).WriteTo(writer); + } + }); + } + + +#line default +#line hidden + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml new file mode 100644 index 0000000000..1edba0340b --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Templates.cshtml @@ -0,0 +1,48 @@ +@functions { + public HelperResult Repeat(int times, Func template) { + return new HelperResult((writer) => { + for(int i = 0; i < times; i++) { + ((HelperResult)template(i)).WriteTo(writer); + } + }); + } +} + +@{ + Func foo = @This works @item!; + @foo("") +} + +
    +@(Repeat(10, @
  • Item #@item
  • )) +
+ +

+@Repeat(10, + @: This is line#@item of markup
+) +

+ +

+@Repeat(10, + @:: This is line#@item of markup
+) +

+ +

+@Repeat(10, + @::: This is line#@item of markup
+) +

+ + +
    + @Repeat(10, @
  • + Item #@item + @{var parent = item;} +
      +
    • Child Items... ?
    • + @*Repeat(10, @
    • Item #@(parent).@item
    • )*@ +
    +
  • ) +
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.codegen.cs new file mode 100644 index 0000000000..fcb11b3b2a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.codegen.cs @@ -0,0 +1,20 @@ +#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "80cd1011b7b46797f36c184b68c352568ccc5060" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_UnfinishedExpressionInCode + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml" +Write(DateTime.); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml new file mode 100644 index 0000000000..bf1d796466 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml @@ -0,0 +1,3 @@ +@{ +@DateTime. +} \ No newline at end of file