Transition tests to use new CodeTree.

Previously they would use CodeDOM dependent concepts.
This commit is contained in:
N. Taylor Mullen 2014-02-13 14:30:34 -08:00
parent da192d7c96
commit f43a17369c
84 changed files with 2247 additions and 4135 deletions

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
private static readonly char[] _newLineChars = { '\r', '\n' };
private RazorEngineHost _host;
private readonly RazorEngineHost _host;
public CSharpPaddingBuilder(RazorEngineHost host)
{

View File

@ -41,15 +41,5 @@ namespace Microsoft.AspNet.Razor.Test
Assert.Equal("Baz", generator.SourceFileName);
Assert.Same(host, generator.Host);
}
[Fact]
public void CodeDomProviderTypeReturnsVBCodeProvider()
{
// Arrange
RazorCodeLanguage service = new CSharpRazorCodeLanguage();
// Assert
Assert.Equal(typeof(CSharpCodeProvider), service.CodeDomProviderType);
}
}
}

View File

@ -1,24 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using System.Text;
namespace Microsoft.AspNet.Razor.Test
{
internal static class CodeCompileUnitExtensions
{
public static string GenerateCode<T>(this CodeCompileUnit ccu) where T : CodeDomProvider, new()
{
StringBuilder output = new StringBuilder();
using (StringWriter writer = new StringWriter(output))
{
T provider = new T();
provider.GenerateCodeFromCompileUnit(ccu, writer, new CodeGeneratorOptions() { IndentString = " " });
}
return output.ToString();
}
}
}

View File

@ -134,13 +134,11 @@ namespace Microsoft.AspNet.Razor.Test.Editor
parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(String.Empty), input.Length, input));
// Assert
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
string generatedCode = capturedArgs.GeneratorResults.CCU.GenerateCode<CSharpCodeProvider>();
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
Assert.Equal(
SimpleCSHTMLDocumentGenerated.ReadAllText(),
MiscUtils.StripRuntimeVersion(generatedCode));
capturedArgs.GeneratorResults.GeneratedCode);
}
}

View File

@ -2,8 +2,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Generator
@ -78,13 +81,20 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[InlineData("HelpersMissingOpenParen")]
[InlineData("NestedHelpers")]
[InlineData("InlineBlocks")]
[InlineData("NestedHelpers")]
[InlineData("LayoutDirective")]
[InlineData("ConditionalAttributes")]
[InlineData("ResolveUrl")]
public void CSharpCodeGeneratorCorrectlyGeneratesRunTimeCode(string testType)
{
RunTest(testType);
if (!Directory.Exists("./tests"))
{
Directory.CreateDirectory("./tests");
}
RunTest(testType, onResults: (results) =>
{
File.WriteAllText(String.Format("./tests/{0}.cs", testType), results.GeneratedCode);
});
}
[Fact]
@ -94,25 +104,27 @@ namespace Microsoft.AspNet.Razor.Test.Generator
"SimpleUnspacedIf.DesignTime.Tabs",
designTimeMode: true,
tabTest: TabTest.Tabs,
expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
expectedDesignTimePragmas: new List<LineMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 2, 1, 15),
/* 02 */ new GeneratedCodeMapping(3, 13, 7, 3),
BuildLineMapping(1, 0,449, 20, 1, 15),
BuildLineMapping(27, 2, 12, 538, 27, 6, 3)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesMappingsForRazorCommentsAtDesignTime()
{
RunTest("RazorComments", "RazorComments.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(4, 3, 3, 6),
/* 02 */ new GeneratedCodeMapping(5, 40, 39, 22),
/* 03 */ new GeneratedCodeMapping(6, 50, 49, 58),
/* 04 */ new GeneratedCodeMapping(12, 3, 3, 24),
/* 05 */ new GeneratedCodeMapping(13, 46, 46, 3),
/* 06 */ new GeneratedCodeMapping(15, 3, 7, 1),
/* 07 */ new GeneratedCodeMapping(15, 8, 8, 1)
RunTest("RazorComments", "RazorComments.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs,
expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(81, 3, 441, 20, 2, 6),
BuildLineMapping(122, 4, 551, 26, 39, 22),
BuildLineMapping(173, 5, 687, 32, 49, 58),
BuildLineMapping(238, 11, 811, 40, 2, 24),
BuildLineMapping(310, 12, 966, 46, 45, 3),
BuildLineMapping(323, 14, 1070, 52, 2, 1),
BuildLineMapping(328, 14, 1142, 56, 7, 1),
});
}
@ -128,16 +140,268 @@ namespace Microsoft.AspNet.Razor.Test.Generator
OpenedIf(withTabs: false);
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesImportStatementsAtDesignTime()
{
RunTest("Imports", "Imports.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(1, 0, 1, 51, 3, 0, 15),
BuildLineMapping(19, 1, 1, 130, 8, 0, 32),
BuildLineMapping(54, 2, 1, 226, 13, 0, 12),
BuildLineMapping(99, 4, 702, 35, 29, 21),
BuildLineMapping(161, 5, 850, 41, 35, 20),
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTime()
{
RunTest("FunctionsBlock",
"FunctionsBlock.DesignTime",
designTimeMode: true,
tabTest: TabTest.NoTabs,
expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(12, 0, 168, 8, 12, 4),
BuildLineMapping(33, 4, 246, 13, 12, 104),
BuildLineMapping(167, 11, 744, 34, 25, 11)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTimeTabs()
{
RunTest("FunctionsBlock",
"FunctionsBlock.DesignTime.Tabs",
designTimeMode: true,
tabTest: TabTest.Tabs,
expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(12, 0, 12, 159, 8, 3, 4),
BuildLineMapping(33, 4, 12, 228, 13, 3, 104),
BuildLineMapping(167, 11, 25, 708, 34, 7, 11)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesMinimalFunctionsBlocksAtDesignTimeTabs()
{
RunTest("FunctionsBlockMinimal",
"FunctionsBlockMinimal.DesignTime.Tabs",
designTimeMode: true,
tabTest: TabTest.Tabs,
expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(16, 2, 12, 176, 8, 6, 55)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesHiddenSpansWithinCode()
{
RunTest("HiddenSpansInCode", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<LineMapping>
{
BuildLineMapping(2, 0, 453, 20, 2, 6),
BuildLineMapping(9, 1, 533, 26, 5, 5)
});
}
[Fact]
public void CSharpCodeGeneratorGeneratesCodeWithParserErrorsInDesignTimeMode()
{
RunTest("ParserError", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(2, 0, 435, 20, 2, 31)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtRuntime()
{
RunTest("Inherits", baselineName: "Inherits.Runtime");
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtDesigntime()
{
RunTest("Inherits", baselineName: "Inherits.Designtime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(20, 2, 286, 11, 10, 25),
BuildLineMapping(1, 0, 591, 25, 1, 5)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCode()
{
RunTest("UnfinishedExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(2, 0, 480, 20, 2, 2),
BuildLineMapping(5, 1, 579, 26, 1, 9),
BuildLineMapping(14, 1, 689, 31, 10, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCodeTabs()
{
RunTest("UnfinishedExpressionInCode",
"UnfinishedExpressionInCode.Tabs",
tabTest: TabTest.Tabs,
designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(2, 0, 480, 20, 2, 2),
BuildLineMapping(5, 1, 579, 26, 1, 9),
BuildLineMapping(14, 1, 10, 683, 31, 4, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasMarkupAndExpressions()
{
RunTest("DesignTime",
designTimeMode: true,
tabTest: TabTest.NoTabs,
expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(222, 16, 8, 182, 9, 0, 7),
BuildLineMapping(229, 16, 323, 14, 15, 26),
BuildLineMapping(265, 18, 430, 21, 18, 9),
BuildLineMapping(274, 20, 523, 29, 0, 1),
BuildLineMapping(20, 1, 881, 46, 13, 36),
BuildLineMapping(74, 2, 1021, 53, 22, 1),
BuildLineMapping(79, 2, 1124, 58, 27, 15),
BuildLineMapping(113, 7, 1223, 65, 2, 12),
BuildLineMapping(129, 8, 1331, 71, 1, 4),
BuildLineMapping(142, 8, 1498, 77, 14, 3),
BuildLineMapping(153, 8, 1635, 84, 25, 1),
BuildLineMapping(204, 13, 1786, 91, 5, 3)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForImplicitExpressionStartedAtEOF()
{
RunTest("ImplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(19, 2, 490, 21, 1, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForExplicitExpressionStartedAtEOF()
{
RunTest("ExplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(20, 2, 491, 21, 2, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForCodeBlockStartedAtEOF()
{
RunTest("CodeBlockAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(2, 0, 444, 20, 2, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpression()
{
RunTest("EmptyImplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(19, 2, 490, 21, 1, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCode()
{
RunTest("EmptyImplicitExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(2, 0, 489, 20, 2, 6),
BuildLineMapping(9, 1, 601, 27, 5, 0),
BuildLineMapping(9, 1, 700, 32, 5, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCodeTabs()
{
RunTest("EmptyImplicitExpressionInCode",
"EmptyImplicitExpressionInCode.Tabs",
tabTest: TabTest.Tabs,
designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(2, 0, 489, 20, 2, 6),
BuildLineMapping(9, 1, 5, 598, 27, 2, 0),
BuildLineMapping(9, 1, 5, 694, 32, 2, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyExplicitExpression()
{
RunTest("EmptyExplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(20, 2, 491, 21, 2, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyCodeBlock()
{
RunTest("EmptyCodeBlock", designTimeMode: true, expectedDesignTimePragmas: new List<LineMapping>()
{
BuildLineMapping(20, 2, 444, 20, 2, 0)
});
}
[Fact]
public void CSharpCodeGeneratorDoesNotRenderLinePragmasIfGenerateLinePragmasIsSetToFalse()
{
RunTest("NoLinePragmas", generatePragmas: false);
}
[Fact]
public void CSharpCodeGeneratorRendersHelpersBlockCorrectlyWhenInstanceHelperRequested()
{
RunTest("Helpers", baselineName: "Helpers.Instance", hostConfig: h => h.StaticHelpers = false);
}
// TODO: This should be re-added once instrumentation support has been added
//[Fact]
//public void CSharpCodeGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested()
//{
// RunTest("Instrumented", hostConfig: host =>
// {
// host.EnableInstrumentation = true;
// host.InstrumentedSourceFilePath = String.Format("~/{0}.cshtml", host.DefaultClassName);
// });
//}
[Fact]
public void CSharpCodeGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes()
{
RunTest("HtmlCommentWithQuote_Single",
tabTest: TabTest.NoTabs);
RunTest("HtmlCommentWithQuote_Double",
tabTest: TabTest.NoTabs);
}
private void OpenedIf(bool withTabs)
{
int tabOffsetForMapping = 0;
int tabOffsetForMapping = 7;
// where the test is running with tabs, the offset into the CS buffer changes for the whitespace mapping
// with spaces we get 7xspace -> offset of 8 (column = offset+1)
// with tabs we get tab + 3 spaces -> offset of 4 chars + 1 = 5
if (withTabs)
{
tabOffsetForMapping = 3;
tabOffsetForMapping -= 3;
}
RunTest("OpenedIf",
@ -154,264 +418,26 @@ namespace Microsoft.AspNet.Razor.Test.Generator
new TestSpan(SpanKind.Markup, 40, 47),
new TestSpan(SpanKind.Code, 47, 47),
},
expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
expectedDesignTimePragmas: new List<LineMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 2, 1, 14),
/* 02 */ new GeneratedCodeMapping(4, 8, 8 - tabOffsetForMapping, 2),
/* 03 */ new GeneratedCodeMapping(5, 8, 8 - tabOffsetForMapping, 0),
BuildLineMapping(17, 2, 425, 20, 1, 14),
BuildLineMapping(38, 3, 7, 497 + tabOffsetForMapping, 25, tabOffsetForMapping, 2),
// Multiply the tab offset absolute index by 2 to account for the first mapping
BuildLineMapping(47, 4, 7, 557 + tabOffsetForMapping * 2, 30, tabOffsetForMapping, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesImportStatementsAtDesignTime()
private static LineMapping BuildLineMapping(int documentAbsoluteIndex, int documentLineIndex, int generatedAbsoluteIndex, int generatedLineIndex, int characterOffsetIndex, int contentLength)
{
RunTest("Imports", "Imports.DesignTime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 2, 1, 15),
/* 02 */ new GeneratedCodeMapping(2, 2, 1, 32),
/* 03 */ new GeneratedCodeMapping(3, 2, 1, 12),
/* 04 */ new GeneratedCodeMapping(5, 30, 30, 21),
/* 05 */ new GeneratedCodeMapping(6, 36, 36, 20),
});
return BuildLineMapping(documentAbsoluteIndex, documentLineIndex, characterOffsetIndex, generatedAbsoluteIndex, generatedLineIndex, characterOffsetIndex, contentLength);
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTime()
private static LineMapping BuildLineMapping(int documentAbsoluteIndex, int documentLineIndex, int documentCharacterOffsetIndex, int generatedAbsoluteIndex, int generatedLineIndex, int generatedCharacterOffsetIndex, int contentLength)
{
RunTest("FunctionsBlock",
"FunctionsBlock.DesignTime",
designTimeMode: true,
tabTest: TabTest.NoTabs,
expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 13, 13, 4),
/* 02 */ new GeneratedCodeMapping(5, 13, 13, 104),
/* 03 */ new GeneratedCodeMapping(12, 26, 26, 11)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesFunctionsBlocksAtDesignTimeTabs()
{
RunTest("FunctionsBlock",
"FunctionsBlock.DesignTime" + ".Tabs",
designTimeMode: true,
tabTest: TabTest.Tabs,
expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 13, 4, 4),
/* 02 */ new GeneratedCodeMapping(5, 13, 4, 104),
/* 03 */ new GeneratedCodeMapping(12, 26, 14, 11)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesMinimalFunctionsBlocksAtDesignTimeTabs()
{
RunTest("FunctionsBlockMinimal",
"FunctionsBlockMinimal.DesignTime" + ".Tabs",
designTimeMode: true,
tabTest: TabTest.Tabs,
expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 13, 7, 55),
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesHiddenSpansWithinCode()
{
RunTest("HiddenSpansInCode", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<GeneratedCodeMapping>
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 6),
/* 02 */ new GeneratedCodeMapping(2, 6, 6, 5)
});
}
[Fact]
public void CSharpCodeGeneratorGeneratesCodeWithParserErrorsInDesignTimeMode()
{
RunTest("ParserError", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 31)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtRuntime()
{
RunTest("Inherits", baselineName: "Inherits.Runtime");
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesInheritsAtDesigntime()
{
RunTest("Inherits", baselineName: "Inherits.Designtime", designTimeMode: true, tabTest: TabTest.NoTabs, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 2, 7, 5),
/* 02 */ new GeneratedCodeMapping(3, 11, 11, 25),
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCode()
{
RunTest("UnfinishedExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 2),
/* 02 */ new GeneratedCodeMapping(2, 2, 7, 9),
/* 03 */ new GeneratedCodeMapping(2, 11, 11, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForUnfinishedExpressionsInCodeTabs()
{
RunTest("UnfinishedExpressionInCode",
"UnfinishedExpressionInCode.Tabs",
tabTest: TabTest.Tabs,
designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 2),
/* 02 */ new GeneratedCodeMapping(2, 2, 7, 9),
/* 03 */ new GeneratedCodeMapping(2, 11, 5, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasMarkupAndExpressions()
{
RunTest("DesignTime",
designTimeMode: true,
tabTest: TabTest.NoTabs,
expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(2, 14, 13, 36),
/* 02 */ new GeneratedCodeMapping(3, 23, 23, 1),
/* 03 */ new GeneratedCodeMapping(3, 28, 28, 15),
/* 04 */ new GeneratedCodeMapping(8, 3, 7, 12),
/* 05 */ new GeneratedCodeMapping(9, 2, 7, 4),
/* 06 */ new GeneratedCodeMapping(9, 15, 15, 3),
/* 07 */ new GeneratedCodeMapping(9, 26, 26, 1),
/* 08 */ new GeneratedCodeMapping(14, 6, 7, 3),
/* 09 */ new GeneratedCodeMapping(17, 9, 24, 7),
/* 10 */ new GeneratedCodeMapping(17, 16, 16, 26),
/* 11 */ new GeneratedCodeMapping(19, 19, 19, 9),
/* 12 */ new GeneratedCodeMapping(21, 1, 1, 1)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForImplicitExpressionStartedAtEOF()
{
RunTest("ImplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 2, 7, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForExplicitExpressionStartedAtEOF()
{
RunTest("ExplicitExpressionAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 3, 7, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForCodeBlockStartedAtEOF()
{
RunTest("CodeBlockAtEOF", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpression()
{
RunTest("EmptyImplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 2, 7, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCode()
{
RunTest("EmptyImplicitExpressionInCode", tabTest: TabTest.NoTabs, designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 6),
/* 02 */ new GeneratedCodeMapping(2, 6, 7, 0),
/* 03 */ new GeneratedCodeMapping(2, 6, 6, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyImplicitExpressionInCodeTabs()
{
RunTest("EmptyImplicitExpressionInCode",
"EmptyImplicitExpressionInCode.Tabs",
tabTest: TabTest.Tabs,
designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(1, 3, 3, 6),
/* 02 */ new GeneratedCodeMapping(2, 6, 7, 0),
/* 03 */ new GeneratedCodeMapping(2, 6, 3, 2)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyExplicitExpression()
{
RunTest("EmptyExplicitExpression", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 3, 7, 0)
});
}
[Fact]
public void CSharpCodeGeneratorCorrectlyGeneratesDesignTimePragmasForEmptyCodeBlock()
{
RunTest("EmptyCodeBlock", designTimeMode: true, expectedDesignTimePragmas: new List<GeneratedCodeMapping>()
{
/* 01 */ new GeneratedCodeMapping(3, 3, 3, 0)
});
}
[Fact]
public void CSharpCodeGeneratorDoesNotRenderLinePragmasIfGenerateLinePragmasIsSetToFalse()
{
RunTest("NoLinePragmas", generatePragmas: false);
}
[Fact]
public void CSharpCodeGeneratorRendersHelpersBlockCorrectlyWhenInstanceHelperRequested()
{
RunTest("Helpers", baselineName: "Helpers.Instance", hostConfig: h => h.StaticHelpers = false);
}
[Fact]
public void CSharpCodeGeneratorCorrectlyInstrumentsRazorCodeWhenInstrumentationRequested()
{
RunTest("Instrumented", hostConfig: host =>
{
host.EnableInstrumentation = true;
host.InstrumentedSourceFilePath = String.Format("~/{0}.cshtml", host.DefaultClassName);
});
}
[Fact]
public void CSharpCodeGeneratorGeneratesUrlsCorrectlyWithCommentsAndQuotes()
{
RunTest("HtmlCommentWithQuote_Single",
tabTest: TabTest.NoTabs);
RunTest("HtmlCommentWithQuote_Double",
tabTest: TabTest.NoTabs);
return new LineMapping(
documentLocation: new MappingLocation(new SourceLocation(documentAbsoluteIndex, documentLineIndex, documentCharacterOffsetIndex), contentLength),
generatedLocation: new MappingLocation(new SourceLocation(generatedAbsoluteIndex, generatedLineIndex, generatedCharacterOffsetIndex), contentLength)
);
}
}
}

View File

@ -22,18 +22,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree
// Act
CodeBuilderResult result = codeBuilder.Build();
// Assert
Assert.Equal(@"namespace TestNamespace
{
#line 1 """"
using FakeNamespace1;
using FakeNamespace1
#line default
#line hidden
;
#line 1 """"
using FakeNamespace2.SubNamespace;
using FakeNamespace2.SubNamespace
#line default
#line hidden
;
public class TestClass
{

View File

@ -6,7 +6,7 @@ using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree
namespace Microsoft.AspNet.Razor.Test.Generator
{
public class CSharpPaddingBuilderTests
{
@ -179,22 +179,6 @@ namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree
Assert.Equal(expectedPadding, padding);
Assert.Equal(numTabs + numSpaces + code.Length, padded.Length);
if (numTabs > 0 || numSpaces > 0)
{
Assert.True(padded.Length > numTabs + numSpaces, "padded string too short");
}
for (int i = 0; i < numTabs; i++)
{
Assert.Equal('\t', padded[i]);
}
for (int i = numTabs; i < numTabs + numSpaces; i++)
{
Assert.Equal(' ', padded[i]);
}
Assert.Equal(numSpaces + numTabs, padding.Length);
}

View File

@ -1,6 +1,10 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Text;
using Microsoft.CSharp;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Generator
@ -10,11 +14,19 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[Fact]
public void CodeTreeComparisonTest()
{
RunTest("CodeTree", onResults: (results, codDOMOutput) =>
RunTest("CodeTree", onResults: (results) =>
{
CodeTreeOutputValidator.ValidateResults(results.GeneratedCode, codDOMOutput, results.DesignTimeLineMappings, results.OLDDesignTimeLineMappings);
File.WriteAllText("./testfile_ct.cs", results.GeneratedCode);
File.WriteAllText("./testfile_cd.cs", codDOMOutput);
CodeDomProvider codeProvider = (CodeDomProvider)Activator.CreateInstance(typeof(CSharpCodeProvider));
CodeGeneratorOptions options = new CodeGeneratorOptions();
var output = new StringBuilder();
using (var writer = new StringWriter(output))
{
codeProvider.GenerateCodeFromCompileUnit(results.CCU, writer, options);
}
string codeDOMOutput = output.ToString();
CodeTreeOutputValidator.ValidateResults(results.GeneratedCode, codeDOMOutput, results.DesignTimeLineMappings, results.OLDDesignTimeLineMappings);
}, designTimeMode: true);
}
}

View File

@ -1,65 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor.Generator;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Generator
{
public class GeneratedCodeMappingTest
{
[Fact]
public void GeneratedCodeMappingsAreEqualIfDataIsEqual()
{
GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 78);
GeneratedCodeMapping right = new GeneratedCodeMapping(12, 34, 56, 78);
Assert.True(left == right);
Assert.True(left.Equals(right));
Assert.True(right.Equals(left));
Assert.True(Equals(left, right));
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfCodeLengthIsNotEqual()
{
GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 87);
GeneratedCodeMapping right = new GeneratedCodeMapping(12, 34, 56, 78);
Assert.False(left == right);
Assert.False(left.Equals(right));
Assert.False(right.Equals(left));
Assert.False(Equals(left, right));
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfStartGeneratedColumnIsNotEqual()
{
GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 87);
GeneratedCodeMapping right = new GeneratedCodeMapping(12, 34, 65, 87);
Assert.False(left == right);
Assert.False(left.Equals(right));
Assert.False(right.Equals(left));
Assert.False(Equals(left, right));
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfStartColumnIsNotEqual()
{
GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 87);
GeneratedCodeMapping right = new GeneratedCodeMapping(12, 43, 56, 87);
Assert.False(left == right);
Assert.False(left.Equals(right));
Assert.False(right.Equals(left));
Assert.False(Equals(left, right));
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfStartLineIsNotEqual()
{
GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 87);
GeneratedCodeMapping right = new GeneratedCodeMapping(21, 34, 56, 87);
Assert.False(left == right);
Assert.False(left.Equals(right));
Assert.False(right.Equals(left));
Assert.False(Equals(left, right));
}
}
}

View File

@ -0,0 +1,125 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Generator
{
public class LineMappingTest
{
[Fact]
public void GeneratedCodeMappingsAreEqualIfDataIsEqual()
{
// Arrange
var left = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 8)
);
var right = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 8)
);
// Assert
Assert.True(left == right);
Assert.True(left.Equals(right));
Assert.True(right.Equals(left));
Assert.True(Equals(left, right));
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfCodeLengthIsNotEqual()
{
// Arrange
var left = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 8)
);
var right = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 5),
new MappingLocation(new SourceLocation(5, 6, 7), 9)
);
// Assert
AssertNotEqual(left, right);
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfStartGeneratedColumnIsNotEqual()
{
// Arrange
var left = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 8)
);
var right = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 8), 8)
);
// Assert
AssertNotEqual(left, right);
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfStartColumnIsNotEqual()
{
// Arrange
var left = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 8), 8)
);
var right = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 8)
);
// Assert
AssertNotEqual(left, right);
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfStartLineIsNotEqual()
{
// Arrange
var left = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 5, 7), 8)
);
var right = new LineMapping(
new MappingLocation(new SourceLocation(1, 1, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 8)
);
// Assert
AssertNotEqual(left, right);
}
[Fact]
public void GeneratedCodeMappingsAreNotEqualIfAbsoluteIndexIsNotEqual()
{
// Arrange
var left = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(4, 6, 7), 8)
);
var right = new LineMapping(
new MappingLocation(new SourceLocation(1, 2, 3), 4),
new MappingLocation(new SourceLocation(5, 6, 7), 9)
);
// Assert
AssertNotEqual(left, right);
}
private void AssertNotEqual(LineMapping left, LineMapping right)
{
Assert.False(left == right);
Assert.False(left.Equals(right));
Assert.False(right.Equals(left));
Assert.False(Equals(left, right));
}
}
}

View File

@ -1,236 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.IO;
using System.Linq;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Generator
{
public class PaddingTest
{
[Fact]
public void CalculatePaddingForEmptySpanReturnsZero()
{
RazorEngineHost host = CreateHost(designTime: true);
Span span = new Span(new SpanBuilder());
int padding = CodeGeneratorPaddingHelper.CalculatePadding(host, span, 0);
Assert.Equal(0, padding);
}
[Theory]
[InlineData(true, false, 4)]
[InlineData(true, false, 2)]
[InlineData(false, true, 4)]
[InlineData(false, true, 2)]
[InlineData(false, false, 4)]
[InlineData(false, false, 2)]
[InlineData(true, true, 4)]
[InlineData(true, true, 2)]
[InlineData(true, true, 1)]
[InlineData(true, true, 0)]
public void CalculatePaddingForEmptySpanWith4Spaces(bool designTime, bool isIndentingWithTabs, int tabSize)
{
RazorEngineHost host = CreateHost(designTime: designTime, isIndentingWithTabs: isIndentingWithTabs, tabSize: tabSize);
Span span = GenerateSpan(@" @{", SpanKind.Code, 3, "");
int padding = CodeGeneratorPaddingHelper.CalculatePadding(host, span, 0);
Assert.Equal(6, padding);
}
[Theory]
[InlineData(true, false, 4)]
[InlineData(true, false, 2)]
[InlineData(false, true, 4)]
[InlineData(false, true, 2)]
[InlineData(false, false, 4)]
[InlineData(false, false, 2)]
[InlineData(true, true, 4)]
[InlineData(true, true, 2)]
[InlineData(true, true, 1)]
[InlineData(true, true, 0)]
public void CalculatePaddingForIfSpanWith4Spaces(bool designTime, bool isIndentingWithTabs, int tabSize)
{
RazorEngineHost host = CreateHost(designTime: designTime, isIndentingWithTabs: isIndentingWithTabs, tabSize: tabSize);
Span span = GenerateSpan(@" @if (true)", SpanKind.Code, 2, "if (true)");
int padding = CodeGeneratorPaddingHelper.CalculatePadding(host, span, 1);
Assert.Equal(4, padding);
}
[Theory]
[InlineData(true, false, 4, 0, 4)]
[InlineData(true, false, 2, 0, 4)]
[InlineData(true, true, 4, 1, 0)]
[InlineData(true, true, 2, 2, 0)]
[InlineData(true, true, 1, 4, 0)]
[InlineData(true, true, 0, 4, 0)]
[InlineData(true, true, 3, 1, 1)]
// in non design time mode padding falls back to spaces to keep runtime code identical to v2 code.
[InlineData(false, true, 4, 0, 5)]
[InlineData(false, true, 2, 0, 5)]
[InlineData(false, false, 4, 0, 5)]
[InlineData(false, false, 2, 0, 5)]
public void VerifyPaddingForIfSpanWith4Spaces(bool designTime, bool isIndentingWithTabs, int tabSize, int numTabs, int numSpaces)
{
RazorEngineHost host = CreateHost(designTime: designTime, isIndentingWithTabs: isIndentingWithTabs, tabSize: tabSize);
// no new lines involved
Span span = GenerateSpan(" @if (true)", SpanKind.Code, 2, "if (true)");
int generatedStart = 1;
string code = " if (true)";
int paddingCharCount;
string padded = CodeGeneratorPaddingHelper.PadStatement(host, code, span, ref generatedStart, out paddingCharCount);
VerifyPadded(numTabs, numSpaces, code, padded, paddingCharCount);
// with new lines involved
Span newLineSpan = GenerateSpan("\t<div>\r\n @if (true)", SpanKind.Code, 3, "if (true)");
string newLinePadded = CodeGeneratorPaddingHelper.PadStatement(host, code, span, ref generatedStart, out paddingCharCount);
VerifyPadded(numTabs, numSpaces, code, newLinePadded, paddingCharCount);
}
[Theory]
[InlineData(true, false, 4, 0, 8)]
[InlineData(true, false, 2, 0, 4)]
[InlineData(true, true, 4, 2, 0)]
[InlineData(true, true, 2, 2, 0)]
[InlineData(true, true, 1, 2, 0)]
[InlineData(true, true, 0, 2, 0)]
[InlineData(true, true, 3, 2, 0)]
// in non design time mode padding falls back to spaces to keep runtime code identical to v2 code.
[InlineData(false, true, 4, 0, 9)]
[InlineData(false, true, 2, 0, 5)]
[InlineData(false, false, 4, 0, 9)]
[InlineData(false, false, 2, 0, 5)]
public void VerifyPaddingForIfSpanWithTwoTabs(bool designTime, bool isIndentingWithTabs, int tabSize, int numTabs, int numSpaces)
{
RazorEngineHost host = CreateHost(designTime: designTime, isIndentingWithTabs: isIndentingWithTabs, tabSize: tabSize);
// no new lines involved
Span span = GenerateSpan("\t\t@if (true)", SpanKind.Code, 2, "if (true)");
int generatedStart = 1;
string code = " if (true)";
int paddingCharCount;
string padded = CodeGeneratorPaddingHelper.PadStatement(host, code, span, ref generatedStart, out paddingCharCount);
VerifyPadded(numTabs, numSpaces, code, padded, paddingCharCount);
// with new lines involved
Span newLineSpan = GenerateSpan("\t<div>\r\n\t\t@if (true)", SpanKind.Code, 3, "if (true)");
string newLinePadded = CodeGeneratorPaddingHelper.PadStatement(host, code, span, ref generatedStart, out paddingCharCount);
VerifyPadded(numTabs, numSpaces, code, newLinePadded, paddingCharCount);
}
[Theory]
[InlineData(true, false, 4, 0, 8)]
[InlineData(true, false, 2, 0, 4)]
[InlineData(true, true, 4, 2, 0)]
[InlineData(true, true, 2, 2, 0)]
[InlineData(true, true, 1, 2, 0)]
[InlineData(true, true, 0, 2, 0)]
// in non design time mode padding falls back to spaces to keep runtime code identical to v2 code.
[InlineData(false, true, 4, 0, 9)]
[InlineData(false, true, 2, 0, 5)]
[InlineData(false, false, 4, 0, 9)]
[InlineData(false, false, 2, 0, 5)]
public void CalculatePaddingForOpenedIf(bool designTime, bool isIndentingWithTabs, int tabSize, int numTabs, int numSpaces)
{
RazorEngineHost host = CreateHost(designTime: designTime, isIndentingWithTabs: isIndentingWithTabs, tabSize: tabSize);
string text = "\r\n<html>\r\n<body>\r\n\t\t@if (true) { \r\n</body>\r\n</html>";
Span span = GenerateSpan(text, SpanKind.Code, 3, "if (true) { \r\n");
int generatedStart = 1;
string code = " if (true) { \r\n";
int paddingCharCount;
string padded = CodeGeneratorPaddingHelper.PadStatement(host, code, span, ref generatedStart, out paddingCharCount);
VerifyPadded(numTabs, numSpaces, code, padded, paddingCharCount);
}
private static void VerifyPadded(int numTabs, int numSpaces, string code, string padded, int paddingCharCount)
{
Assert.Equal(numTabs + numSpaces + code.Length, padded.Length);
if (numTabs > 0 || numSpaces > 0)
{
Assert.True(padded.Length > numTabs + numSpaces, "padded string too short");
}
for (int i = 0; i < numTabs; i++)
{
Assert.Equal('\t', padded[i]);
}
for (int i = numTabs; i < numTabs + numSpaces; i++)
{
Assert.Equal(' ', padded[i]);
}
Assert.Equal(numSpaces + numTabs, paddingCharCount);
}
private static RazorEngineHost CreateHost(bool designTime, bool isIndentingWithTabs = false, int tabSize = 4)
{
return new RazorEngineHost(new CSharpRazorCodeLanguage())
{
DesignTimeMode = designTime,
IsIndentingWithTabs = isIndentingWithTabs,
TabSize = tabSize,
};
}
private static Span GenerateSpan(string text, SpanKind spanKind, int spanIndex, string spanText)
{
Span[] spans = GenerateSpans(text, spanKind, spanIndex, spanText);
return spans[spanIndex];
}
private static Span[] GenerateSpans(string text, SpanKind spanKind, int spanIndex, string spanText)
{
Assert.True(spanIndex > 0);
RazorParser parser = new RazorParser(new CSharpCodeParser(), new HtmlMarkupParser());
Span[] spans;
using (var reader = new StringReader(text))
{
ParserResults results = parser.Parse(reader);
spans = results.Document.Flatten().ToArray();
}
Assert.True(spans.Length > spanIndex);
Assert.Equal(spanKind, spans[spanIndex].Kind);
Assert.Equal(spanText, spans[spanIndex].Content);
return spans;
}
}
}

View File

@ -3,8 +3,6 @@
//#define GENERATE_BASELINES
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@ -12,6 +10,7 @@ using System.Linq;
using System.Text;
using System.Web.WebPages.TestUtils;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Utils;
using Microsoft.TestCommon;
@ -36,11 +35,11 @@ namespace Microsoft.AspNet.Razor.Test.Generator
string baselineName = null,
bool generatePragmas = true,
bool designTimeMode = false,
IList<GeneratedCodeMapping> expectedDesignTimePragmas = null,
IList<LineMapping> expectedDesignTimePragmas = null,
TestSpan[] spans = null,
TabTest tabTest = TabTest.Both,
Action<RazorEngineHost> hostConfig = null,
Action<GeneratorResults, string> onResults = null)
Action<GeneratorResults> onResults = null)
{
bool testRun = false;
@ -91,11 +90,11 @@ namespace Microsoft.AspNet.Razor.Test.Generator
string baselineName,
bool generatePragmas,
bool designTimeMode,
IList<GeneratedCodeMapping> expectedDesignTimePragmas,
IList<LineMapping> expectedDesignTimePragmas,
TestSpan[] spans,
bool withTabs,
Action<RazorEngineHost> hostConfig,
Action<GeneratorResults, string> onResults = null)
Action<GeneratorResults> onResults = null)
{
// Load the test files
if (baselineName == null)
@ -142,40 +141,22 @@ namespace Microsoft.AspNet.Razor.Test.Generator
using (StringTextBuffer buffer = new StringTextBuffer(source))
{
results = engine.GenerateCode(buffer, className: name, rootNamespace: TestRootNamespaceName, sourceFileName: generatePragmas ? String.Format("{0}.{1}", name, FileExtension) : null);
}
// Generate code
CodeCompileUnit ccu = results.CCU;
CodeDomProvider codeProvider = (CodeDomProvider)Activator.CreateInstance(host.CodeLanguage.CodeDomProviderType);
CodeGeneratorOptions options = new CodeGeneratorOptions();
// Both run-time and design-time use these settings. See:
// * $/Dev10/pu/SP_WebTools/venus/html/Razor/Impl/RazorCodeGenerator.cs:204
// * $/Dev10/Releases/RTMRel/ndp/fx/src/xsp/System/Web/Compilation/BuildManagerHost.cs:373
options.BlankLinesBetweenMembers = false;
options.IndentString = String.Empty;
StringBuilder output = new StringBuilder();
using (StringWriter writer = new StringWriter(output))
{
codeProvider.GenerateCodeFromCompileUnit(ccu, writer, options);
}
WriteBaseline(String.Format(@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\{0}\Output\{1}.{2}", LanguageName, baselineName, BaselineExtension), MiscUtils.StripRuntimeVersion(output.ToString()));
// Only called if GENERATE_BASELINES is set, otherwise compiled out.
WriteBaseline(String.Format(@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\{0}\Output\{1}.{2}", LanguageName, baselineName, BaselineExtension), results.GeneratedCode);
#if !GENERATE_BASELINES
string textOutput = MiscUtils.StripRuntimeVersion(output.ToString());
string textOutput = results.GeneratedCode;
if (onResults != null)
{
onResults(results, textOutput);
onResults(results);
}
//// Verify code against baseline
Assert.Equal(expectedOutput, textOutput);
#endif
#endif
IEnumerable<Span> generatedSpans = results.Document.Flatten();
@ -197,13 +178,14 @@ namespace Microsoft.AspNet.Razor.Test.Generator
Assert.True(results.DesignTimeLineMappings != null && results.DesignTimeLineMappings.Count > 0);
Assert.Equal(expectedDesignTimePragmas.Count, results.DesignTimeLineMappings.Count);
/*
Assert.Equal(
expectedDesignTimePragmas.ToArray(),
results.DesignTimeLineMappings
.OrderBy(p => p.Key)
.Select(p => p.Value)
.ToArray());*/
for (var i = 0; i < expectedDesignTimePragmas.Count; i++)
{
if(!expectedDesignTimePragmas[i].Equals(results.DesignTimeLineMappings[i]))
{
Assert.True(false, String.Format("Line mapping {0} is not equivalent.", i));
}
}
}
}
}
@ -211,7 +193,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
[Conditional("GENERATE_BASELINES")]
private void WriteBaseline(string baselineFile, string output)
{
string root = RecursiveFind("Runtime.sln", Path.GetFullPath("."));
string root = RecursiveFind("Razor.sln", Path.GetFullPath("."));
string baselinePath = Path.Combine(root, baselineFile);
// Update baseline

View File

@ -38,7 +38,25 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CodeCompileUnitExtensions.cs" />
<ProjectReference Include="..\..\src\Microsoft.AspNet.Razor\Microsoft.AspNet.Razor.net45.csproj">
<Project>{8b129ff9-0b8f-4e0c-8dfc-0137d8550fb7}</Project>
<Name>Microsoft.AspNet.Razor.net45</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.TestCommon\Microsoft.TestCommon.csproj">
<Project>{FCCC4CB7-BAF7-4A57-9F89-E5766FE536C0}</Project>
<Name>Microsoft.TestCommon</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Compile Include="CSharpRazorCodeLanguageTest.cs" />
<Compile Include="Editor\RazorEditorParserTest.cs" />
<Compile Include="Framework\BlockExtensions.cs" />
<Compile Include="Framework\BlockTypes.cs" />
<Compile Include="Framework\CodeParserTestBase.cs" />
@ -53,200 +71,135 @@
<Compile Include="Generator\CodeTree\CodeTreeOutputValidator.cs" />
<Compile Include="Generator\CodeTree\CSharpCodeBuilderTests.cs" />
<Compile Include="Generator\CodeTree\CSharpPaddingBuilderTests.cs" />
<Compile Include="Generator\GeneratedCodeMappingTest.cs" />
<Compile Include="Generator\PaddingTest.cs" />
<Compile Include="Generator\CSharpRazorCodeGeneratorTest.cs" />
<Compile Include="Generator\LineMappingTest.cs" />
<Compile Include="Generator\RazorCodeGeneratorTest.cs" />
<Compile Include="Generator\TabTest.cs" />
<Compile Include="Generator\TestSpan.cs" />
<Compile Include="Parser\BlockTest.cs" />
<Compile Include="Parser\CallbackParserListenerTest.cs" />
<Compile Include="Parser\CSharp\CSharpAutoCompleteTest.cs" />
<Compile Include="Parser\CSharp\CSharpBlockTest.cs" />
<Compile Include="Parser\CSharp\CSharpDirectivesTest.cs" />
<Compile Include="Parser\CSharp\CSharpErrorTest.cs" />
<Compile Include="Parser\CSharp\CSharpExplicitExpressionTest.cs" />
<Compile Include="Parser\CSharp\CSharpHelperTest.cs" />
<Compile Include="Parser\CSharp\CSharpImplicitExpressionTest.cs" />
<Compile Include="Parser\CSharp\CSharpLayoutDirectiveTest.cs" />
<Compile Include="Parser\CSharp\CSharpNestedStatementsTest.cs" />
<Compile Include="Parser\CSharp\CSharpRazorCommentsTest.cs" />
<Compile Include="Parser\CSharp\CSharpReservedWordsTest.cs" />
<Compile Include="Parser\CSharp\CSharpSectionTest.cs" />
<Compile Include="Parser\CSharp\CSharpSpecialBlockTest.cs" />
<Compile Include="Parser\CSharp\CSharpStatementTest.cs" />
<Compile Include="Parser\CSharp\CSharpTemplateTest.cs" />
<Compile Include="Parser\CSharp\CSharpToMarkupSwitchTest.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Parser\CSharp\CSharpVerbatimBlockTest.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Parser\CSharp\CSharpToMarkupSwitchTest.cs" />
<Compile Include="Parser\CSharp\CSharpVerbatimBlockTest.cs" />
<Compile Include="Parser\CSharp\CSharpWhitespaceHandlingTest.cs" />
<Compile Include="Parser\CSharp\CsHtmlDocumentTest.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Parser\Html\HtmlAttributeTest.cs" />
<Compile Include="Parser\Html\HtmlUrlAttributeTest.cs" />
<Compile Include="Parser\ParserVisitorExtensionsTest.cs" />
<Compile Include="Parser\Html\HtmlBlockTest.cs" />
<Compile Include="Parser\Html\HtmlDocumentTest.cs" />
<Compile Include="Parser\Html\HtmlErrorTest.cs" />
<Compile Include="Parser\Html\HtmlParserTestUtils.cs" />
<Compile Include="Parser\Html\HtmlTagsTest.cs" />
<Compile Include="Parser\CSharp\CSharpReservedWordsTest.cs" />
<Compile Include="Parser\Html\HtmlToCodeSwitchTest.cs" />
<Compile Include="Parser\Html\HtmlUrlAttributeTest.cs" />
<Compile Include="Parser\ParserContextTest.cs" />
<Compile Include="Parser\ParserVisitorExtensionsTest.cs" />
<Compile Include="Parser\PartialParsing\CSharpPartialParsingTest.cs" />
<Compile Include="Parser\CSharp\CSharpHelperTest.cs" />
<Compile Include="Generator\RazorCodeGeneratorTest.cs" />
<Compile Include="Parser\PartialParsing\PartialParsingTestBase.cs" />
<Compile Include="Parser\RazorParserTest.cs" />
<Compile Include="Parser\WhitespaceRewriterTest.cs" />
<Compile Include="RazorCodeLanguageTest.cs" />
<Compile Include="Editor\RazorEditorParserTest.cs" />
<Compile Include="RazorDirectiveAttributeTest.cs" />
<Compile Include="RazorEngineHostTest.cs" />
<Compile Include="RazorTemplateEngineTest.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Blocks.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\CodeBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\CodeBlockAtEOF.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Comments.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ConditionalAttributes.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyCodeBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyExplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyImplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyImplicitExpressionInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ExplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ExplicitExpressionAtEOF.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ExpressionsInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Helpers.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Helpers.Instance.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingCloseParen.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingName.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingOpenBrace.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingOpenParen.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HiddenSpansInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ImplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ImplicitExpressionAtEOF.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Imports.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Imports.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Inherits.Designtime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Inherits.Runtime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\InlineBlocks.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Instrumented.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\LayoutDirective.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\MarkupInCodeBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\NestedCodeBlocks.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\NestedHelpers.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\NoLinePragmas.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ParserError.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\RazorComments.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ResolveUrl.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Sections.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Templates.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\UnfinishedExpressionInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\RazorComments.DesignTime.cs" />
<Compile Include="StringTextBuffer.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\OpenedIf.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\OpenedIf.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\UnfinishedExpressionInCode.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyImplicitExpressionInCode.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock_Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlockMinimal.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\SimpleUnspacedIf.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HtmlCommentWithQuote_Single.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HtmlCommentWithQuote_Double.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\CodeTree.cs" />
<Compile Include="Text\LineTrackingStringBufferTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerCommentTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerLiteralTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerIdentifierTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerOperatorsTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerTestBase.cs" />
<Compile Include="Tokenizer\CSharpTokenizerTest.cs" />
<Compile Include="Tokenizer\TokenizerLookaheadTest.cs" />
<Compile Include="Tokenizer\HtmlTokenizerTest.cs" />
<Compile Include="Tokenizer\HtmlTokenizerTestBase.cs" />
<Compile Include="Tokenizer\TokenizerTestBase.cs" />
<Compile Include="Utils\MiscUtils.cs" />
<Compile Include="Generator\CSharpRazorCodeGeneratorTest.cs" />
<Compile Include="CSharpRazorCodeLanguageTest.cs" />
<Compile Include="Parser\CallbackParserListenerTest.cs" />
<Compile Include="Parser\CSharp\CSharpExplicitExpressionTest.cs" />
<Compile Include="Parser\CSharp\CSharpSectionTest.cs" />
<Compile Include="Parser\BlockTest.cs" />
<Compile Include="Text\BufferingTextReaderTest.cs" />
<Compile Include="Parser\CSharp\CSharpErrorTest.cs" />
<Compile Include="Parser\CSharp\CSharpImplicitExpressionTest.cs" />
<Compile Include="Parser\CSharp\CSharpSpecialBlockTest.cs" />
<Compile Include="Parser\Html\HtmlBlockTest.cs" />
<Compile Include="Parser\CSharp\CSharpBlockTest.cs" />
<Compile Include="Text\LineTrackingStringBufferTest.cs" />
<Compile Include="Text\LookaheadTextReaderTestBase.cs" />
<Compile Include="Text\SourceLocationTest.cs" />
<Compile Include="Text\SourceLocationTrackerTest.cs" />
<Compile Include="Text\TextBufferReaderTest.cs" />
<Compile Include="Utils\DisposableActionTest.cs" />
<Compile Include="Parser\Html\HtmlDocumentTest.cs" />
<Compile Include="Parser\ParserContextTest.cs" />
<Compile Include="Parser\Html\HtmlErrorTest.cs" />
<Compile Include="Parser\Html\HtmlParserTestUtils.cs" />
<Compile Include="Parser\Html\HtmlToCodeSwitchTest.cs" />
<Compile Include="Parser\RazorParserTest.cs" />
<Compile Include="Text\SourceLocationTest.cs" />
<Compile Include="Utils\SpanAssert.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Text\TextChangeTest.cs" />
<Compile Include="Text\TextReaderExtensionsTest.cs" />
<Compile Include="Utils\EnumerableUtils.cs" />
<Compile Include="Utils\MiscAssert.cs" />
<Compile Include="Tokenizer\CSharpTokenizerCommentTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerIdentifierTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerLiteralTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerOperatorsTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerTest.cs" />
<Compile Include="Tokenizer\CSharpTokenizerTestBase.cs" />
<Compile Include="Tokenizer\HtmlTokenizerTest.cs" />
<Compile Include="Tokenizer\HtmlTokenizerTestBase.cs" />
<Compile Include="Tokenizer\TokenizerLookaheadTest.cs" />
<Compile Include="Tokenizer\TokenizerTestBase.cs" />
<Compile Include="Utils\DisposableActionTest.cs" />
<Compile Include="Utils\MiscUtils.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\UnfinishedExpressionInCode.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\UnfinishedExpressionInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Templates.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\SimpleUnspacedIf.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Sections.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ResolveUrl.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\RazorComments.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\RazorComments.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ParserError.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\OpenedIf.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\OpenedIf.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\NoLinePragmas.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\NestedHelpers.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\NestedCodeBlocks.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\MarkupInCodeBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\LayoutDirective.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\InlineBlocks.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Inherits.Runtime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Inherits.Designtime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Imports.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Imports.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ImplicitExpressionAtEOF.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ImplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HtmlCommentWithQuote_Single.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HtmlCommentWithQuote_Double.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HiddenSpansInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingOpenParen.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingOpenBrace.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\HelpersMissingCloseParen.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Helpers.Instance.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Helpers.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlockMinimal.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock_Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock.DesignTime.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock.DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\FunctionsBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ExpressionsInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ExplicitExpressionAtEOF.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ExplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyImplicitExpressionInCode.Tabs.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyImplicitExpressionInCode.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyImplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyExplicitExpression.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\EmptyCodeBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\DesignTime.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\ConditionalAttributes.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\CodeBlockAtEOF.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\CodeBlock.cs" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Output\Blocks.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNet.Razor\Microsoft.AspNet.Razor.net45.csproj">
<Project>{8b129ff9-0b8f-4e0c-8dfc-0137d8550fb7}</Project>
<Name>Microsoft.AspNet.Razor.net45</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.TestCommon\Microsoft.TestCommon.csproj">
<Project>{FCCC4CB7-BAF7-4A57-9F89-E5766FE536C0}</Project>
<Name>Microsoft.TestCommon</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\nested-1000.html" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Templates.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Blocks.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\CodeBlock.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\NoLinePragmas.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ExplicitExpression.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ImplicitExpression.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Imports.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\MarkupInCodeBlock.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\DesignTime.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ExpressionsInCode.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\FunctionsBlock.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Sections.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Inherits.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\NestedHelpers.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Instrumented.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\RazorComments.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ParserError.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ImplicitExpressionAtEOF.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\CodeBlockAtEOF.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ExplicitExpressionAtEOF.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ConditionalAttributes.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\DesignTime.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\EmptyCodeBlock.cshtml" />
@ -257,6 +210,99 @@
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\EmptyImplicitExpression.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\EmptyImplicitExpressionInCode.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ExplicitExpression.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ExplicitExpressionAtEOF.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ExpressionsInCode.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\FunctionsBlock.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\FunctionsBlock_Tabs.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\FunctionsBlockMinimal.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Helpers.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingCloseParen.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingOpenBrace.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingOpenParen.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HiddenSpansInCode.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HtmlCommentWithQuote_Double.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HtmlCommentWithQuote_Single.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ImplicitExpression.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ImplicitExpressionAtEOF.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Imports.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Inherits.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\InlineBlocks.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\LayoutDirective.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\MarkupInCodeBlock.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\NestedCodeBlocks.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\NestedHelpers.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\NoLinePragmas.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\OpenedIf.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ParserError.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\RazorComments.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ResolveUrl.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Sections.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\SimpleUnspacedIf.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Templates.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\UnfinishedExpressionInCode.cshtml" />
</ItemGroup>
@ -267,41 +313,11 @@
<EmbeddedResource Include="TestFiles\DesignTime\Simple.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\Helpers.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingCloseParen.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingName.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingOpenBrace.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HelpersMissingOpenParen.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\NestedCodeBlocks.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\InlineBlocks.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\EmptyImplicitExpressionInCode.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HiddenSpansInCode.cshtml" />
<EmbeddedResource Include="TestFiles\nested-1000.html" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ResolveUrl.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\LayoutDirective.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\ConditionalAttributes.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\OpenedIf.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\FunctionsBlock_Tabs.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\FunctionsBlockMinimal.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\SimpleUnspacedIf.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HtmlCommentWithQuote_Double.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\HtmlCommentWithQuote_Single.cshtml" />
<EmbeddedResource Include="TestFiles\CodeGenerator\CS\Source\CodeTree.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -44,8 +44,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
),
Factory.Code(" }").AsStatement()),
new RazorError(
RazorResources.ParseError_Unexpected_Keyword_After_At(
"if"),
RazorResources.ParseError_Unexpected_Keyword_After_At("if"),
new SourceLocation(13, 0, 13)));
}
@ -107,8 +106,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ImplicitExpressionTest("Html.En(code()", "Html.En(code()",
AcceptedCharacters.Any,
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(8, 0, 8)));
}
@ -397,7 +395,7 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC
{
const string document = "foreach(var f in Foo) { /* foo bar baz";
SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code,
new RazorError(String.Format(RazorResources.ParseError_BlockComment_Not_Terminated), 24, 0, 24),
new RazorError(RazorResources.ParseError_BlockComment_Not_Terminated, 24, 0, 24),
new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), SourceLocation.Zero));
}

View File

@ -47,9 +47,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" })
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_Code,
"}", "{"),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"),
SourceLocation.Zero));
}
@ -141,8 +139,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("foo bar\r\nbaz").AsExpression()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_ExplicitExpression, ')', '('),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_ExplicitExpression, ')', '('),
new SourceLocation(0, 0, 0)));
}
@ -158,8 +155,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("foo bar\r\n").AsExpression()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_ExplicitExpression, ')', '('),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_ExplicitExpression, ')', '('),
new SourceLocation(0, 0, 0)));
}
@ -173,8 +169,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(4, 0, 4)));
}
@ -189,8 +184,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("Foo(Bar(Baz)\r\nBiz\r\nBoz")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
),
new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(3, 0, 3)));
}
@ -207,8 +201,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("Foo(Bar(Baz)\r\nBiz\r\n")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
),
new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(3, 0, 3)));
}
@ -224,8 +217,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"[", "]"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("[", "]"),
new SourceLocation(3, 0, 3)));
}
@ -243,8 +235,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"[", "]"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("[", "]"),
new SourceLocation(3, 0, 3)));
}
@ -258,8 +249,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_Code, '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, '}', '{'),
SourceLocation.Zero));
}
@ -272,8 +262,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" var foo = bar; if(foo != null) { bar(); } ").AsFunctionsBody()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"functions", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("functions", '}', '{'),
SourceLocation.Zero));
}
@ -291,8 +280,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"else", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("else", '}', '{'),
new SourceLocation(19, 0, 19)));
}
@ -304,8 +292,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"else if", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("else if", '}', '{'),
new SourceLocation(19, 0, 19)));
}
@ -317,8 +304,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("do { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"do", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("do", '}', '{'),
SourceLocation.Zero));
}
@ -330,8 +316,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("try { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"try", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("try", '}', '{'),
SourceLocation.Zero));
}
@ -343,8 +328,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"catch", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("catch", '}', '{'),
new SourceLocation(15, 0, 15)));
}
@ -356,8 +340,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"finally", '}', '{'),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("finally", '}', '{'),
new SourceLocation(15, 0, 15)));
}
@ -430,8 +413,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo)) { var bar = foo; }").AsStatement()
),
new RazorError(
RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed(
"{", ")"),
RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed("{", ")"),
new SourceLocation(7, 0, 7)));
}
@ -462,8 +444,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo bar\r\n").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(2, 0, 2)));
}
@ -476,8 +457,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("foreach(foo bar\r\n").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(7, 0, 7)));
}
@ -490,8 +470,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("do { } while(foo bar\r\n").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(12, 0, 12)));
}
@ -504,8 +483,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("using(foo bar\r\n").AsStatement()
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(5, 0, 5)));
}
@ -522,8 +500,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("}").AsStatement().Accepts(AcceptedCharacters.None)
),
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
new SourceLocation(2, 0, 2)));
}
@ -608,7 +585,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
expectedErrors: new[] {
new RazorError(
RazorResources.ParseError_Expected_CloseBracket_Before_EOF( "(", ")"),
RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
14, 0, 14)
});

View File

@ -32,9 +32,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.EmptyCSharp().AsExpression()
),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_ExplicitExpression,
")", "("),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_ExplicitExpression, ")", "("),
new SourceLocation(1, 0, 1)));
}

View File

@ -52,8 +52,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
Factory.EmptyHtml()),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ErrorComponent_Newline),
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(RazorResources.ErrorComponent_Newline),
7, 0, 7));
}
@ -68,8 +67,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("helper")),
Factory.Markup("{")),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ErrorComponent_Character("{")),
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(RazorResources.ErrorComponent_Character("{")),
7, 0, 7));
}
@ -88,12 +86,10 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsStatement()
.AutoCompleteWith("}")))),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ErrorComponent_Character("(")),
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(RazorResources.ErrorComponent_Character("(")),
8, 0, 8),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"helper", "}", "{"),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("helper", "}", "{"),
1, 0, 1));
}
@ -108,8 +104,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("helper ").Accepts(AcceptedCharacters.None),
Factory.EmptyCSharp().Hidden())),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ErrorComponent_EndOfFile),
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(RazorResources.ErrorComponent_EndOfFile),
8, 0, 8));
}
@ -123,8 +118,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.CodeTransition(),
Factory.MetaCode("helper").Accepts(AcceptedCharacters.Any))),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ErrorComponent_EndOfFile),
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(RazorResources.ErrorComponent_EndOfFile),
7, 0, 7));
}
@ -141,8 +135,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" \r\n").Hidden()),
Factory.Markup(@" ")),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ErrorComponent_Newline),
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(RazorResources.ErrorComponent_Newline),
30, 0, 30));
}
@ -214,8 +207,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Markup(" <p>Foo</p>").Accepts(AcceptedCharacters.None)),
Factory.EmptyCSharp().AsStatement()))),
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"helper", "}", "{"),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("helper", "}", "{"),
1, 0, 1));
}
@ -296,8 +288,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
expectedErrors: new[]
{
new RazorError(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"helper", "}", "{"),
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("helper", "}", "{"),
new SourceLocation(1, 0, 1))
});
}

View File

@ -21,8 +21,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.CodeTransition(),
Factory.MetaCode("section\r\n"))),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(
RazorResources.ErrorComponent_EndOfFile),
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(RazorResources.ErrorComponent_EndOfFile),
10, 1, 0));
}
@ -52,8 +51,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("section \r\n")),
Factory.Markup(" ")),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(
RazorResources.ErrorComponent_EndOfFile),
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(RazorResources.ErrorComponent_EndOfFile),
23, 1, 4));
}
@ -82,8 +80,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("section ")),
Factory.Markup("9 { <p>Foo</p> }")),
new RazorError(
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(
RazorResources.ErrorComponent_Character("9")),
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(RazorResources.ErrorComponent_Character("9")),
9, 0, 9));
}
@ -99,7 +96,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Markup("-bar { <p>Foo</p> }")),
new RazorError(RazorResources.ParseError_MissingOpenBraceAfterSection, 12, 0, 12));
}
[Fact]
public void ParserOutputsErrorOnNestedSections()
{
@ -123,8 +120,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
Factory.EmptyHtml()),
new RazorError(
RazorResources.ParseError_Sections_Cannot_Be_Nested(
RazorResources.SectionExample_CS),
RazorResources.ParseError_Sections_Cannot_Be_Nested(RazorResources.SectionExample_CS),
23, 0, 23));
}

View File

@ -1,288 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
{
public class CsHtmlDocumentTest : CsHtmlMarkupParserTestBase
{
[Fact]
public void UnterminatedBlockCommentCausesRazorError()
{
ParseDocumentTest("@* Foo Bar",
new MarkupBlock(
Factory.EmptyHtml(),
new CommentBlock(
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment(" Foo Bar", HtmlSymbolType.RazorComment)
)
),
new RazorError(RazorResources.ParseError_RazorComment_Not_Terminated, SourceLocation.Zero));
}
[Fact]
public void BlockCommentInMarkupDocumentIsHandledCorrectly()
{
ParseDocumentTest("<ul>" + Environment.NewLine
+ " @* This is a block comment </ul> *@ foo",
new MarkupBlock(
Factory.Markup("<ul>\r\n "),
new CommentBlock(
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment(" This is a block comment </ul> ", HtmlSymbolType.RazorComment),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition)
),
Factory.Markup(" foo")
));
}
[Fact]
public void BlockCommentInMarkupBlockIsHandledCorrectly()
{
ParseBlockTest("<ul>" + Environment.NewLine
+ " @* This is a block comment </ul> *@ foo </ul>",
new MarkupBlock(
Factory.Markup("<ul>\r\n "),
new CommentBlock(
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment(" This is a block comment </ul> ", HtmlSymbolType.RazorComment),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition)
),
Factory.Markup(" foo </ul>").Accepts(AcceptedCharacters.None)
));
}
[Fact]
public void BlockCommentAtStatementStartInCodeBlockIsHandledCorrectly()
{
ParseDocumentTest("@if(Request.IsAuthenticated) {" + Environment.NewLine
+ " @* User is logged in! } *@" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
new StatementBlock(
Factory.CodeTransition(),
Factory.Code("if(Request.IsAuthenticated) {\r\n ").AsStatement(),
new CommentBlock(
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment(" User is logged in! } ", CSharpSymbolType.RazorComment),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition)
),
Factory.Code("\r\n Write(\"Hello friend!\");\r\n}").AsStatement())));
}
[Fact]
public void BlockCommentInStatementInCodeBlockIsHandledCorrectly()
{
ParseDocumentTest("@if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = @* User is logged in! ; *@;" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
new StatementBlock(
Factory.CodeTransition(),
Factory.Code("if(Request.IsAuthenticated) {\r\n var foo = ").AsStatement(),
new CommentBlock(
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment(" User is logged in! ; ", CSharpSymbolType.RazorComment),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition)
),
Factory.Code(";\r\n Write(\"Hello friend!\");\r\n}").AsStatement())));
}
[Fact]
public void BlockCommentInStringIsIgnored()
{
ParseDocumentTest("@if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = \"@* User is logged in! ; *\";" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
new StatementBlock(
Factory.CodeTransition(),
Factory.Code("if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = \"@* User is logged in! ; *\";" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}").AsStatement())));
}
[Fact]
public void BlockCommentInCSharpBlockCommentIsIgnored()
{
ParseDocumentTest("@if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = /*@* User is logged in! */ *@ */;" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
new StatementBlock(
Factory.CodeTransition(),
Factory.Code("if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = /*@* User is logged in! */ *@ */;" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}").AsStatement())));
}
[Fact]
public void BlockCommentInCSharpLineCommentIsIgnored()
{
ParseDocumentTest("@if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = //@* User is logged in! */ *@;" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}",
new MarkupBlock(
Factory.EmptyHtml(),
new StatementBlock(
Factory.CodeTransition(),
Factory.Code("if(Request.IsAuthenticated) {" + Environment.NewLine
+ " var foo = //@* User is logged in! */ *@;" + Environment.NewLine
+ " Write(\"Hello friend!\");" + Environment.NewLine
+ "}").AsStatement())));
}
[Fact]
public void BlockCommentInImplicitExpressionIsHandledCorrectly()
{
ParseDocumentTest("@Html.Foo@*bar*@",
new MarkupBlock(
Factory.EmptyHtml(),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.Code("Html.Foo").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace)
),
Factory.EmptyHtml(),
new CommentBlock(
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment("bar", HtmlSymbolType.RazorComment),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition)
),
Factory.EmptyHtml()));
}
[Fact]
public void BlockCommentAfterDotOfImplicitExpressionIsHandledCorrectly()
{
ParseDocumentTest("@Html.@*bar*@",
new MarkupBlock(
Factory.EmptyHtml(),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.Code("Html").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace)
),
Factory.Markup("."),
new CommentBlock(
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment("bar", HtmlSymbolType.RazorComment),
Factory.MetaMarkup("*", HtmlSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.MarkupTransition(HtmlSymbolType.RazorCommentTransition)
),
Factory.EmptyHtml()));
}
[Fact]
public void BlockCommentInParensOfImplicitExpressionIsHandledCorrectly()
{
ParseDocumentTest("@Html.Foo(@*bar*@ 4)",
new MarkupBlock(
Factory.EmptyHtml(),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.Code("Html.Foo(").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.Any),
new CommentBlock(
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment("bar", CSharpSymbolType.RazorComment),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition)
),
Factory.Code(" 4)").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace)
),
Factory.EmptyHtml()));
}
[Fact]
public void BlockCommentInBracketsOfImplicitExpressionIsHandledCorrectly()
{
ParseDocumentTest("@Html.Foo[@*bar*@ 4]",
new MarkupBlock(
Factory.EmptyHtml(),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.Code("Html.Foo[").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.Any),
new CommentBlock(
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment("bar", CSharpSymbolType.RazorComment),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition)
),
Factory.Code(" 4]").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharacters.NonWhiteSpace)
),
Factory.EmptyHtml()));
}
[Fact]
public void BlockCommentInParensOfConditionIsHandledCorrectly()
{
ParseDocumentTest("@if(@*bar*@) {}",
new MarkupBlock(
Factory.EmptyHtml(),
new StatementBlock(
Factory.CodeTransition(),
Factory.Code("if(").AsStatement(),
new CommentBlock(
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment("bar", CSharpSymbolType.RazorComment),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition)
),
Factory.Code(") {}").AsStatement()
)));
}
[Fact]
public void BlockCommentInExplicitExpressionIsHandledCorrectly()
{
ParseDocumentTest("@(1 + @*bar*@ 1)",
new MarkupBlock(
Factory.EmptyHtml(),
new ExpressionBlock(
Factory.CodeTransition(),
Factory.MetaCode("(").Accepts(AcceptedCharacters.None),
Factory.Code("1 + ").AsExpression(),
new CommentBlock(
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.Comment("bar", CSharpSymbolType.RazorComment),
Factory.MetaCode("*", CSharpSymbolType.RazorCommentStar).Accepts(AcceptedCharacters.None),
Factory.CodeTransition(CSharpSymbolType.RazorCommentTransition)
),
Factory.Code(" 1").AsExpression(),
Factory.MetaCode(")").Accepts(AcceptedCharacters.None)
),
Factory.EmptyHtml()));
}
}
}

View File

@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Razor.Test
public void ServicesPropertyContainsEntriesForCSharpCodeLanguageService()
{
// Assert
Assert.Equal(2, RazorCodeLanguage.Languages.Count);
Assert.Equal(1, RazorCodeLanguage.Languages.Count);
Assert.IsType<CSharpRazorCodeLanguage>(RazorCodeLanguage.Languages["cshtml"]);
}

View File

@ -1,6 +1,5 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.CodeDom;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.TestCommon;
@ -71,46 +70,6 @@ namespace Microsoft.AspNet.Razor.Test
Assert.ThrowsArgumentNull(() => CreateHost().DecorateCodeGenerator(null), "incomingCodeGenerator");
}
[Fact]
public void PostProcessGeneratedCodeRequiresNonNullCompileUnit()
{
Assert.ThrowsArgumentNull(() => CreateHost().PostProcessGeneratedCode(codeCompileUnit: null,
generatedNamespace: new CodeNamespace(),
generatedClass: new CodeTypeDeclaration(),
executeMethod: new CodeMemberMethod()),
"codeCompileUnit");
}
[Fact]
public void PostProcessGeneratedCodeRequiresNonNullGeneratedNamespace()
{
Assert.ThrowsArgumentNull(() => CreateHost().PostProcessGeneratedCode(codeCompileUnit: new CodeCompileUnit(),
generatedNamespace: null,
generatedClass: new CodeTypeDeclaration(),
executeMethod: new CodeMemberMethod()),
"generatedNamespace");
}
[Fact]
public void PostProcessGeneratedCodeRequiresNonNullGeneratedClass()
{
Assert.ThrowsArgumentNull(() => CreateHost().PostProcessGeneratedCode(codeCompileUnit: new CodeCompileUnit(),
generatedNamespace: new CodeNamespace(),
generatedClass: null,
executeMethod: new CodeMemberMethod()),
"generatedClass");
}
[Fact]
public void PostProcessGeneratedCodeRequiresNonNullExecuteMethod()
{
Assert.ThrowsArgumentNull(() => CreateHost().PostProcessGeneratedCode(codeCompileUnit: new CodeCompileUnit(),
generatedNamespace: new CodeNamespace(),
generatedClass: new CodeTypeDeclaration(),
executeMethod: null),
"executeMethod");
}
[Fact]
public void DecorateCodeParserDoesNotModifyIncomingParser()
{
@ -150,26 +109,6 @@ namespace Microsoft.AspNet.Razor.Test
Assert.Same(expected, actual);
}
[Fact]
public void PostProcessGeneratedCodeDoesNotModifyCode()
{
// Arrange
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeNamespace ns = new CodeNamespace();
CodeTypeDeclaration typeDecl = new CodeTypeDeclaration();
CodeMemberMethod execMethod = new CodeMemberMethod();
// Act
CreateHost().PostProcessGeneratedCode(compileUnit, ns, typeDecl, execMethod);
// Assert
Assert.Empty(compileUnit.Namespaces);
Assert.Empty(ns.Imports);
Assert.Empty(ns.Types);
Assert.Empty(typeDecl.Members);
Assert.Empty(execMethod.Statements);
}
private static RazorEngineHost CreateHost()
{
return new RazorEngineHost(new CSharpRazorCodeLanguage());

View File

@ -167,7 +167,6 @@ namespace Microsoft.AspNet.Razor.Test
Assert.Single(results.ParserErrors);
Assert.NotNull(results.Document);
Assert.NotNull(results.GeneratedCode);
Assert.Null(results.DesignTimeLineMappings);
}
[Fact]

View File

@ -1,194 +1,138 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Blocks {
#line hidden
public Blocks() {
}
public override void Execute() {
public class Blocks
{
#line hidden
public Blocks()
{
}
public override void Execute()
{
#line 1 "Blocks.cshtml"
int i = 1;
#line default
#line hidden
WriteLiteral("\r\n\r\n");
WriteLiteral("\r\n\r\n");
#line 5 "Blocks.cshtml"
while(i <= 10) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
WriteLiteral(" <p>Hello from C#, #");
Write(
#line 6 "Blocks.cshtml"
Write(i);
i
#line default
#line hidden
WriteLiteral("</p>\r\n");
);
WriteLiteral("</p>\r\n");
#line 7 "Blocks.cshtml"
i += 1;
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 10 "Blocks.cshtml"
if(i == 11) {
#line default
#line hidden
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
#line 12 "Blocks.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 14 "Blocks.cshtml"
switch(i) {
case 11:
#line default
#line hidden
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
#line 17 "Blocks.cshtml"
break;
default:
#line default
#line hidden
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
#line 20 "Blocks.cshtml"
break;
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 23 "Blocks.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
WriteLiteral(" <p>Hello again from C#, #");
WriteLiteral(" <p>Hello again from C#, #");
Write(
#line 24 "Blocks.cshtml"
Write(j);
j
#line default
#line hidden
WriteLiteral("</p>\r\n");
);
WriteLiteral("</p>\r\n");
#line 25 "Blocks.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 27 "Blocks.cshtml"
try {
#line default
#line hidden
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
#line 29 "Blocks.cshtml"
} catch(Exception ex) {
#line default
#line hidden
WriteLiteral(" <p>Oh no! An error occurred: ");
WriteLiteral(" <p>Oh no! An error occurred: ");
Write(
#line 30 "Blocks.cshtml"
Write(ex.Message);
ex.Message
#line default
#line hidden
WriteLiteral("</p>\r\n");
);
WriteLiteral("</p>\r\n");
#line 31 "Blocks.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n<p>i is now ");
WriteLiteral("\r\n<p>i is now ");
Write(
#line 33 "Blocks.cshtml"
Write(i);
i
#line default
#line hidden
WriteLiteral("</p>\r\n\r\n");
);
WriteLiteral("</p>\r\n\r\n");
#line 35 "Blocks.cshtml"
lock(new object()) {
#line default
#line hidden
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
#line 37 "Blocks.cshtml"
}
#line default
#line hidden
}
}
}
}
}

View File

@ -1,31 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class CodeBlock {
#line hidden
public CodeBlock() {
}
public override void Execute() {
public class CodeBlock
{
#line hidden
public CodeBlock()
{
}
public override void Execute()
{
#line 1 "CodeBlock.cshtml"
for(int i = 1; i <= 10; i++) {
Output.Write("<p>Hello from C#, #" + i.ToString() + "</p>");
}
#line default
#line hidden
}
}
}
}
}

View File

@ -1,27 +1,27 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class CodeBlockAtEOF {
#line hidden
public CodeBlockAtEOF() {
}
public override void Execute() {
public class CodeBlockAtEOF
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public CodeBlockAtEOF()
{
}
public override void Execute()
{
#line 1 "CodeBlockAtEOF.cshtml"
#line default
#line hidden
}
}
}
}
}

View File

@ -1,12 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Razor.Test.TestFiles.CodeGenerator.CS.Output
namespace TestOutput
{
using System;
public class CodeTree
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public CodeTree()
{
}
public override void Execute()
{
}
}
}

View File

@ -1,38 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class Comments {
public override void Execute() {
#line 1 "Comments.cshtml"
//This is not going to be rendered
#line default
#line hidden
WriteLiteral("<p>This is going to be rendered</p>\r\n");
#line 3 "Comments.cshtml"
/* Neither is this
nor this
nor this */
#line default
#line hidden
}
}
}

View File

@ -1,197 +1,108 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class ConditionalAttributes {
#line hidden
public ConditionalAttributes() {
}
public override void Execute() {
public class ConditionalAttributes
{
#line hidden
public ConditionalAttributes()
{
}
public override void Execute()
{
#line 1 "ConditionalAttributes.cshtml"
var ch = true;
var cls = "bar";
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" href=\"Foo\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <p");
WriteAttribute("class", Tuple.Create(" class=\"", 74), Tuple.Create("\"", 86)
WriteLiteral(" <a href=\"Foo\" />\r\n <p");
WriteAttribute("class", Tuple.Create(" class=\"", 74), Tuple.Create("\"", 86),
Tuple.Create(Tuple.Create("", 82), Tuple.Create<System.Object, System.Int32>(
#line 5 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create("", 82), Tuple.Create<System.Object, System.Int32>(cls
cls
#line default
#line hidden
, 82), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <p");
WriteAttribute("class", Tuple.Create(" class=\"", 98), Tuple.Create("\"", 114)
, Tuple.Create(Tuple.Create("", 106), Tuple.Create("foo", 106), true)
, 82), false));
WriteLiteral(" />\r\n <p");
WriteAttribute("class", Tuple.Create(" class=\"", 98), Tuple.Create("\"", 114), Tuple.Create(Tuple.Create("", 106), Tuple.Create("foo", 106), true),
Tuple.Create(Tuple.Create(" ", 109), Tuple.Create<System.Object, System.Int32>(
#line 6 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create(" ", 109), Tuple.Create<System.Object, System.Int32>(cls
cls
#line default
#line hidden
, 110), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <p");
WriteAttribute("class", Tuple.Create(" class=\"", 126), Tuple.Create("\"", 142)
, 110), false));
WriteLiteral(" />\r\n <p");
WriteAttribute("class", Tuple.Create(" class=\"", 126), Tuple.Create("\"", 142),
Tuple.Create(Tuple.Create("", 134), Tuple.Create<System.Object, System.Int32>(
#line 7 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create("", 134), Tuple.Create<System.Object, System.Int32>(cls
cls
#line default
#line hidden
, 134), false)
, Tuple.Create(Tuple.Create(" ", 138), Tuple.Create("foo", 139), true)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("checked", Tuple.Create(" checked=\"", 174), Tuple.Create("\"", 187)
, 134), false), Tuple.Create(Tuple.Create(" ", 138), Tuple.Create("foo", 139), true));
WriteLiteral(" />\r\n <input type=\"checkbox\"");
WriteAttribute("checked", Tuple.Create(" checked=\"", 174), Tuple.Create("\"", 187),
Tuple.Create(Tuple.Create("", 184), Tuple.Create<System.Object, System.Int32>(
#line 8 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create("", 184), Tuple.Create<System.Object, System.Int32>(ch
ch
#line default
#line hidden
, 184), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("checked", Tuple.Create(" checked=\"", 219), Tuple.Create("\"", 236)
, Tuple.Create(Tuple.Create("", 229), Tuple.Create("foo", 229), true)
, 184), false));
WriteLiteral(" />\r\n <input type=\"checkbox\"");
WriteAttribute("checked", Tuple.Create(" checked=\"", 219), Tuple.Create("\"", 236), Tuple.Create(Tuple.Create("", 229), Tuple.Create("foo", 229), true),
Tuple.Create(Tuple.Create(" ", 232), Tuple.Create<System.Object, System.Int32>(
#line 9 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create(" ", 232), Tuple.Create<System.Object, System.Int32>(ch
ch
#line default
#line hidden
, 233), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <p");
WriteAttribute("class", Tuple.Create(" class=\"", 248), Tuple.Create("\"", 281)
, Tuple.Create(Tuple.Create("", 256), Tuple.Create<System.Object, System.Int32>(new Template(__razor_attribute_value_writer => {
, 233), false));
WriteLiteral(" />\r\n <p");
WriteAttribute("class", Tuple.Create(" class=\"", 248), Tuple.Create("\"", 281),
Tuple.Create(Tuple.Create("", 256), Tuple.Create<System.Object, System.Int32>(new Template((__razor_attribute_value_writer) => {
#line 10 "ConditionalAttributes.cshtml"
if(cls != null) {
#line default
#line hidden
WriteTo(__razor_attribute_value_writer,
#line 10 "ConditionalAttributes.cshtml"
WriteTo(__razor_attribute_value_writer, cls);
cls
#line default
#line hidden
);
#line 10 "ConditionalAttributes.cshtml"
}
#line default
#line hidden
}), 256), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 293), Tuple.Create("\"", 305)
, Tuple.Create(Tuple.Create("", 300), Tuple.Create<System.Object, System.Int32>(Href("~/Foo")
, 300), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <script");
WriteAttribute("src", Tuple.Create(" src=\"", 322), Tuple.Create("\"", 373)
}
), 256), false));
WriteLiteral(" />\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 293), Tuple.Create("\"", 305), Tuple.Create(Tuple.Create("", 300), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 300), false));
WriteLiteral(" />\r\n <script");
WriteAttribute("src", Tuple.Create(" src=\"", 322), Tuple.Create("\"", 373),
Tuple.Create(Tuple.Create("", 328), Tuple.Create<System.Object, System.Int32>(
#line 12 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create("", 328), Tuple.Create<System.Object, System.Int32>(Url.Content("~/Scripts/jquery-1.6.2.min.js")
Url.Content("~/Scripts/jquery-1.6.2.min.js")
#line default
#line hidden
, 328), false)
);
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral("></script>\r\n");
WriteLiteral(" <script");
WriteAttribute("src", Tuple.Create(" src=\"", 420), Tuple.Create("\"", 487)
, 328), false));
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script");
WriteAttribute("src", Tuple.Create(" src=\"", 420), Tuple.Create("\"", 487),
Tuple.Create(Tuple.Create("", 426), Tuple.Create<System.Object, System.Int32>(
#line 13 "ConditionalAttributes.cshtml"
, Tuple.Create(Tuple.Create("", 426), Tuple.Create<System.Object, System.Int32>(Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")
Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")
#line default
#line hidden
, 426), false)
);
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral("></script>\r\n");
WriteLiteral(" <script");
WriteLiteral(" src=\"http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js\"");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral("></script>\r\n");
, 426), false));
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script src=\"http://ajax.aspnetcdn.com/aja" +
"x/jquery.ui/1.8.16/jquery-ui.min.js\" type=\"text/javascript\"></script>\r\n");
#line 15 "ConditionalAttributes.cshtml"
#line default
#line hidden
}
}
}
}
}

View File

@ -1,110 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class DesignTime {
private static object @__o;
#line hidden
#line 9 "DesignTime.cshtml"
public static Template Foo() {
#line default
#line hidden
return new Template(__razor_helper_writer => {
#line 10 "DesignTime.cshtml"
if(true) {
#line default
#line hidden
#line 11 "DesignTime.cshtml"
}
#line default
#line hidden
});
#line 12 "DesignTime.cshtml"
}
#line default
#line hidden
public DesignTime() {
}
public override void Execute() {
#line 1 "DesignTime.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
#line 2 "DesignTime.cshtml"
__o = i;
#line default
#line hidden
#line 3 "DesignTime.cshtml"
}
#line default
#line hidden
#line 4 "DesignTime.cshtml"
__o = Foo(Bar.Baz);
#line default
#line hidden
#line 5 "DesignTime.cshtml"
__o = Foo(item => new Template(__razor_template_writer => {
#line default
#line hidden
#line 6 "DesignTime.cshtml"
__o = baz;
#line default
#line hidden
#line 7 "DesignTime.cshtml"
}));
#line default
#line hidden
DefineSection("Footer", () => {
#line 8 "DesignTime.cshtml"
__o = bar;
#line default
#line hidden
});
}
}
}

View File

@ -1,110 +1,100 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class DesignTime {
private static object @__o;
#line hidden
#line 9 "DesignTime.cshtml"
public static Template Foo() {
public class DesignTime
{
private static object @__o;
public static Template
#line 17 "DesignTime.cshtml"
Foo() {
#line default
#line hidden
return new Template(__razor_helper_writer => {
#line 10 "DesignTime.cshtml"
return new Template((__razor_helper_writer) => {
#line 17 "DesignTime.cshtml"
if(true) {
#line default
#line hidden
#line 11 "DesignTime.cshtml"
#line 19 "DesignTime.cshtml"
}
#line default
#line hidden
});
#line 12 "DesignTime.cshtml"
}
);
#line 21 "DesignTime.cshtml"
}
#line default
#line hidden
public DesignTime() {
}
public override void Execute() {
#line 1 "DesignTime.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public DesignTime()
{
}
public override void Execute()
{
#line 2 "DesignTime.cshtml"
__o = i;
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
__o =
#line 3 "DesignTime.cshtml"
i
#line default
#line hidden
;
#line 3 "DesignTime.cshtml"
}
#line default
#line hidden
#line 4 "DesignTime.cshtml"
__o = Foo(Bar.Baz);
#line default
#line hidden
#line 5 "DesignTime.cshtml"
__o = Foo(item => new Template(__razor_template_writer => {
#line default
#line hidden
#line 6 "DesignTime.cshtml"
__o = baz;
#line default
#line hidden
#line 7 "DesignTime.cshtml"
}));
#line default
#line hidden
DefineSection("Footer", () => {
__o =
#line 8 "DesignTime.cshtml"
__o = bar;
Foo(Bar.Baz)
#line default
#line hidden
});
}
}
;
__o =
#line 9 "DesignTime.cshtml"
Foo(
#line default
#line hidden
item => new Template((__razor_template_writer) => {
__o =
#line 9 "DesignTime.cshtml"
baz
#line default
#line hidden
;
}
)
#line 9 "DesignTime.cshtml"
)
#line default
#line hidden
;
DefineSection("Footer", () => {
__o =
#line 14 "DesignTime.cshtml"
bar
#line default
#line hidden
;
}
);
}
}
}

View File

@ -1,27 +1,27 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class EmptyCodeBlock
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public EmptyCodeBlock()
{
}
public class EmptyCodeBlock {
#line hidden
public EmptyCodeBlock() {
}
public override void Execute() {
#line 1 "EmptyCodeBlock.cshtml"
public override void Execute()
{
#line 3 "EmptyCodeBlock.cshtml"
#line default
#line hidden
}
}
}
}
}

View File

@ -1,29 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class EmptyExplicitExpression {
private static object @__o;
#line hidden
public EmptyExplicitExpression() {
}
public override void Execute() {
#line 1 "EmptyExplicitExpression.cshtml"
__o = ;
namespace TestOutput
{
using System;
public class EmptyExplicitExpression
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public EmptyExplicitExpression()
{
}
public override void Execute()
{
__o =
#line 3 "EmptyExplicitExpression.cshtml"
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,29 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class EmptyImplicitExpression {
private static object @__o;
#line hidden
public EmptyImplicitExpression() {
}
public override void Execute() {
#line 1 "EmptyImplicitExpression.cshtml"
__o = ;
namespace TestOutput
{
using System;
public class EmptyImplicitExpression
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public EmptyImplicitExpression()
{
}
public override void Execute()
{
__o =
#line 3 "EmptyImplicitExpression.cshtml"
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,43 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class EmptyImplicitExpressionInCode {
private static object @__o;
#line hidden
public EmptyImplicitExpressionInCode() {
}
public override void Execute() {
public class EmptyImplicitExpressionInCode
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public EmptyImplicitExpressionInCode()
{
}
public override void Execute()
{
#line 1 "EmptyImplicitExpressionInCode.cshtml"
#line default
#line hidden
__o =
#line 2 "EmptyImplicitExpressionInCode.cshtml"
__o = ;
#line default
#line hidden
#line 3 "EmptyImplicitExpressionInCode.cshtml"
#line default
#line hidden
}
}
;
#line 2 "EmptyImplicitExpressionInCode.cshtml"
#line default
#line hidden
}
}
}

View File

@ -1,43 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class EmptyImplicitExpressionInCode {
private static object @__o;
#line hidden
public EmptyImplicitExpressionInCode() {
}
public override void Execute() {
public class EmptyImplicitExpressionInCode
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public EmptyImplicitExpressionInCode()
{
}
public override void Execute()
{
#line 1 "EmptyImplicitExpressionInCode.cshtml"
#line default
#line hidden
__o =
#line 2 "EmptyImplicitExpressionInCode.cshtml"
__o = ;
#line default
#line hidden
#line 3 "EmptyImplicitExpressionInCode.cshtml"
#line default
#line hidden
}
}
;
#line 2 "EmptyImplicitExpressionInCode.cshtml"
#line default
#line hidden
}
}
}

View File

@ -1,30 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class ExplicitExpression {
#line hidden
public ExplicitExpression() {
}
public override void Execute() {
WriteLiteral("1 + 1 = ");
namespace TestOutput
{
using System;
public class ExplicitExpression
{
#line hidden
public ExplicitExpression()
{
}
public override void Execute()
{
WriteLiteral("1 + 1 = ");
Write(
#line 1 "ExplicitExpression.cshtml"
Write(1+1);
1+1
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,29 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class ExplicitExpressionAtEOF {
private static object @__o;
#line hidden
public ExplicitExpressionAtEOF() {
}
public override void Execute() {
#line 1 "ExplicitExpressionAtEOF.cshtml"
__o = ;
namespace TestOutput
{
using System;
public class ExplicitExpressionAtEOF
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public ExplicitExpressionAtEOF()
{
}
public override void Execute()
{
__o =
#line 3 "ExplicitExpressionAtEOF.cshtml"
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,89 +1,68 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class ExpressionsInCode {
#line hidden
public ExpressionsInCode() {
}
public override void Execute() {
public class ExpressionsInCode
{
#line hidden
public ExpressionsInCode()
{
}
public override void Execute()
{
#line 1 "ExpressionsInCode.cshtml"
object foo = null;
string bar = "Foo";
#line default
#line hidden
WriteLiteral("\r\n\r\n");
WriteLiteral("\r\n\r\n");
#line 6 "ExpressionsInCode.cshtml"
if(foo != null) {
#line default
#line hidden
Write(
#line 7 "ExpressionsInCode.cshtml"
Write(foo);
foo
#line default
#line hidden
);
#line 7 "ExpressionsInCode.cshtml"
} else {
#line default
#line hidden
WriteLiteral(" <p>Foo is Null!</p>\r\n");
WriteLiteral(" <p>Foo is Null!</p>\r\n");
#line 10 "ExpressionsInCode.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n<p>\r\n");
WriteLiteral("\r\n<p>\r\n");
#line 13 "ExpressionsInCode.cshtml"
if(!String.IsNullOrEmpty(bar)) {
#line default
#line hidden
Write(
#line 14 "ExpressionsInCode.cshtml"
Write(bar.Replace("F", "B"));
bar.Replace("F", "B")
#line default
#line hidden
);
#line 14 "ExpressionsInCode.cshtml"
}
#line default
#line hidden
WriteLiteral("</p>");
}
}
WriteLiteral("</p>");
}
}
}

View File

@ -1,46 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class FunctionsBlock {
private static object @__o;
#line hidden
public class FunctionsBlock
{
private static object @__o;
#line 1 "FunctionsBlock.cshtml"
#line default
#line hidden
#line 2 "FunctionsBlock.cshtml"
#line 5 "FunctionsBlock.cshtml"
Random _rand = new Random();
private int RandomInt() {
return _rand.Next();
}
#line default
#line hidden
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public FunctionsBlock()
{
}
public FunctionsBlock() {
}
public override void Execute() {
#line 3 "FunctionsBlock.cshtml"
__o = RandomInt();
public override void Execute()
{
__o =
#line 12 "FunctionsBlock.cshtml"
RandomInt()
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,46 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class FunctionsBlock {
private static object @__o;
#line hidden
public class FunctionsBlock
{
private static object @__o;
#line 1 "FunctionsBlock.cshtml"
#line default
#line hidden
#line 2 "FunctionsBlock.cshtml"
#line 5 "FunctionsBlock.cshtml"
Random _rand = new Random();
private int RandomInt() {
return _rand.Next();
}
#line default
#line hidden
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public FunctionsBlock()
{
}
public FunctionsBlock() {
}
public override void Execute() {
#line 3 "FunctionsBlock.cshtml"
__o = RandomInt();
public override void Execute()
{
__o =
#line 12 "FunctionsBlock.cshtml"
RandomInt()
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,49 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class FunctionsBlock {
#line hidden
public class FunctionsBlock
{
#line 1 "FunctionsBlock.cshtml"
#line default
#line hidden
#line 5 "FunctionsBlock.cshtml"
Random _rand = new Random();
private int RandomInt() {
return _rand.Next();
}
#line default
#line hidden
#line hidden
public FunctionsBlock()
{
}
public FunctionsBlock() {
}
public override void Execute() {
WriteLiteral("\r\n");
WriteLiteral("\r\nHere\'s a random number: ");
public override void Execute()
{
WriteLiteral("\r\n");
WriteLiteral("\r\nHere\'s a random number: ");
Write(
#line 12 "FunctionsBlock.cshtml"
Write(RandomInt());
RandomInt()
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,30 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class FunctionsBlockMinimal {
#line hidden
#line 1 "FunctionsBlockMinimal.cshtml"
public class FunctionsBlockMinimal
{
private static object @__o;
#line 3 "FunctionsBlockMinimal.cshtml"
string foo(string input) {
return input + "!";
}
#line default
#line hidden
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public FunctionsBlockMinimal()
{
}
public FunctionsBlockMinimal() {
}
public override void Execute() {
}
}
public override void Execute()
{
}
}
}

View File

@ -1,49 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class FunctionsBlock_Tabs {
#line hidden
public class FunctionsBlock_Tabs
{
#line 1 "FunctionsBlock_Tabs.cshtml"
#line default
#line hidden
#line 5 "FunctionsBlock_Tabs.cshtml"
Random _rand = new Random();
private int RandomInt() {
return _rand.Next();
}
#line default
#line hidden
#line hidden
public FunctionsBlock_Tabs()
{
}
public FunctionsBlock_Tabs() {
}
public override void Execute() {
WriteLiteral("\r\n");
WriteLiteral("\r\nHere\'s a random number: ");
public override void Execute()
{
WriteLiteral("\r\n");
WriteLiteral("\r\nHere\'s a random number: ");
Write(
#line 12 "FunctionsBlock_Tabs.cshtml"
Write(RandomInt());
RandomInt()
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,106 +1,86 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Helpers {
#line hidden
public class Helpers
{
public Template
#line 1 "Helpers.cshtml"
public Template Bold(string s) {
Bold(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "Helpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteTo(__razor_helper_writer,
#line 3 "Helpers.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 4 "Helpers.cshtml"
#line default
#line hidden
});
}
);
#line 4 "Helpers.cshtml"
}
#line default
#line hidden
public Template
#line 6 "Helpers.cshtml"
public Template Italic(string s) {
Italic(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 6 "Helpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <em>");
WriteLiteralTo(__razor_helper_writer, " <em>");
WriteTo(__razor_helper_writer,
#line 8 "Helpers.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
#line 9 "Helpers.cshtml"
#line default
#line hidden
});
}
);
#line 9 "Helpers.cshtml"
}
#line default
#line hidden
public Helpers() {
}
public override void Execute() {
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line hidden
public Helpers()
{
}
public override void Execute()
{
WriteLiteral("\r\n");
WriteLiteral("\r\n");
Write(
#line 11 "Helpers.cshtml"
Write(Bold("Hello"));
Bold("Hello")
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,106 +1,86 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Helpers {
#line hidden
public class Helpers
{
public static Template
#line 1 "Helpers.cshtml"
public static Template Bold(string s) {
Bold(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "Helpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteTo(__razor_helper_writer,
#line 3 "Helpers.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 4 "Helpers.cshtml"
#line default
#line hidden
});
}
);
#line 4 "Helpers.cshtml"
}
#line default
#line hidden
public static Template
#line 6 "Helpers.cshtml"
public static Template Italic(string s) {
Italic(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 6 "Helpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <em>");
WriteLiteralTo(__razor_helper_writer, " <em>");
WriteTo(__razor_helper_writer,
#line 8 "Helpers.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
#line 9 "Helpers.cshtml"
#line default
#line hidden
});
}
);
#line 9 "Helpers.cshtml"
}
#line default
#line hidden
public Helpers() {
}
public override void Execute() {
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line hidden
public Helpers()
{
}
public override void Execute()
{
WriteLiteral("\r\n");
WriteLiteral("\r\n");
Write(
#line 11 "Helpers.cshtml"
Write(Bold("Hello"));
Bold("Hello")
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,66 +1,55 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class HelpersMissingCloseParen {
#line hidden
public class HelpersMissingCloseParen
{
public static Template
#line 1 "HelpersMissingCloseParen.cshtml"
public static Template Bold(string s) {
Bold(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "HelpersMissingCloseParen.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingCloseParen.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 4 "HelpersMissingCloseParen.cshtml"
#line default
#line hidden
});
}
);
#line 4 "HelpersMissingCloseParen.cshtml"
}
#line default
#line hidden
public static Template
#line 6 "HelpersMissingCloseParen.cshtml"
public static Template Italic(string s
Italic(string s
@Bold("Hello")
#line default
#line hidden
public HelpersMissingCloseParen() {
}
public override void Execute() {
WriteLiteral("\r\n");
#line hidden
public HelpersMissingCloseParen()
{
}
}
}
public override void Execute()
{
WriteLiteral("\r\n");
}
}
}

View File

@ -1,21 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class HelpersMissingName {
#line hidden
public HelpersMissingName() {
}
public override void Execute() {
}
}
}

View File

@ -1,72 +1,60 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class HelpersMissingOpenBrace {
#line hidden
public class HelpersMissingOpenBrace
{
public static Template
#line 1 "HelpersMissingOpenBrace.cshtml"
public static Template Bold(string s) {
Bold(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "HelpersMissingOpenBrace.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingOpenBrace.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 4 "HelpersMissingOpenBrace.cshtml"
#line default
#line hidden
});
}
);
#line 4 "HelpersMissingOpenBrace.cshtml"
}
#line default
#line hidden
public static Template
#line 6 "HelpersMissingOpenBrace.cshtml"
public static Template Italic(string s)
Italic(string s)
#line default
#line hidden
public HelpersMissingOpenBrace() {
}
public override void Execute() {
WriteLiteral("\r\n");
#line hidden
public HelpersMissingOpenBrace()
{
}
public override void Execute()
{
WriteLiteral("\r\n");
Write(
#line 7 "HelpersMissingOpenBrace.cshtml"
Write(Italic(s));
Italic(s)
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,72 +1,60 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class HelpersMissingOpenParen {
#line hidden
public class HelpersMissingOpenParen
{
public static Template
#line 1 "HelpersMissingOpenParen.cshtml"
public static Template Bold(string s) {
Bold(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "HelpersMissingOpenParen.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingOpenParen.cshtml"
WriteTo(__razor_helper_writer, s);
s
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 4 "HelpersMissingOpenParen.cshtml"
#line default
#line hidden
});
}
);
#line 4 "HelpersMissingOpenParen.cshtml"
}
#line default
#line hidden
public static Template
#line 6 "HelpersMissingOpenParen.cshtml"
public static Template Italic
Italic
#line default
#line hidden
public HelpersMissingOpenParen() {
}
public override void Execute() {
WriteLiteral("\r\n");
#line hidden
public HelpersMissingOpenParen()
{
}
public override void Execute()
{
WriteLiteral("\r\n");
Write(
#line 7 "HelpersMissingOpenParen.cshtml"
Write(Bold("Hello"));
Bold("Hello")
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,35 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class HiddenSpansInCode {
#line hidden
public HiddenSpansInCode() {
}
public override void Execute() {
public class HiddenSpansInCode
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public HiddenSpansInCode()
{
}
public override void Execute()
{
#line 1 "HiddenSpansInCode.cshtml"
#line default
#line hidden
#line 2 "HiddenSpansInCode.cshtml"
@Da
#line default
#line hidden
}
}
}
}
}

View File

@ -1,30 +1,19 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class HtmlCommentWithQuote_Double
{
#line hidden
public HtmlCommentWithQuote_Double()
{
}
public class HtmlCommentWithQuote_Double {
#line hidden
public HtmlCommentWithQuote_Double() {
}
public override void Execute() {
WriteLiteral("<!-- \" -->\r\n<img");
WriteAttribute("src", Tuple.Create(" src=\"", 16), Tuple.Create("\"", 41)
, Tuple.Create(Tuple.Create("", 22), Tuple.Create<System.Object, System.Int32>(Href("~/images/submit.png")
, 22), false)
);
WriteLiteral(" />");
}
}
public override void Execute()
{
WriteLiteral("<!-- \" -->\r\n<img");
WriteAttribute("src", Tuple.Create(" src=\"", 16), Tuple.Create("\"", 41), Tuple.Create(Tuple.Create("", 22), Tuple.Create<System.Object, System.Int32>(Href("~/images/submit.png"), 22), false));
WriteLiteral(" />");
}
}
}

View File

@ -1,30 +1,19 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class HtmlCommentWithQuote_Single
{
#line hidden
public HtmlCommentWithQuote_Single()
{
}
public class HtmlCommentWithQuote_Single {
#line hidden
public HtmlCommentWithQuote_Single() {
}
public override void Execute() {
WriteLiteral("<!-- \' -->\r\n<img");
WriteAttribute("src", Tuple.Create(" src=\"", 16), Tuple.Create("\"", 41)
, Tuple.Create(Tuple.Create("", 22), Tuple.Create<System.Object, System.Int32>(Href("~/images/submit.png")
, 22), false)
);
WriteLiteral(" />");
}
}
public override void Execute()
{
WriteLiteral("<!-- \' -->\r\n<img");
WriteAttribute("src", Tuple.Create(" src=\"", 16), Tuple.Create("\"", 41), Tuple.Create(Tuple.Create("", 22), Tuple.Create<System.Object, System.Int32>(Href("~/images/submit.png"), 22), false));
WriteLiteral(" />");
}
}
}

View File

@ -1,45 +1,34 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class ImplicitExpression {
#line hidden
public ImplicitExpression() {
}
public override void Execute() {
public class ImplicitExpression
{
#line hidden
public ImplicitExpression()
{
}
public override void Execute()
{
#line 1 "ImplicitExpression.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
WriteLiteral(" <p>This is item #");
WriteLiteral(" <p>This is item #");
Write(
#line 2 "ImplicitExpression.cshtml"
Write(i);
i
#line default
#line hidden
WriteLiteral("</p>\r\n");
);
WriteLiteral("</p>\r\n");
#line 3 "ImplicitExpression.cshtml"
}
#line default
#line hidden
}
}
}
}
}

View File

@ -1,29 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class ImplicitExpressionAtEOF {
private static object @__o;
#line hidden
public ImplicitExpressionAtEOF() {
}
public override void Execute() {
#line 1 "ImplicitExpressionAtEOF.cshtml"
__o = ;
namespace TestOutput
{
using System;
public class ImplicitExpressionAtEOF
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public ImplicitExpressionAtEOF()
{
}
public override void Execute()
{
__o =
#line 3 "ImplicitExpressionAtEOF.cshtml"
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,53 +1,48 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
#line 3 "Imports.cshtml"
using System;
#line default
#line hidden
namespace TestOutput
{
#line 1 "Imports.cshtml"
using System.IO;
using System.IO
#line default
#line hidden
;
#line 2 "Imports.cshtml"
using Foo = System.Text.Encoding;
using Foo = System.Text.Encoding
#line default
#line hidden
public class Imports {
private static object @__o;
#line hidden
public Imports() {
}
public override void Execute() {
#line 4 "Imports.cshtml"
__o = typeof(Path).FullName;
;
#line 3 "Imports.cshtml"
using System
#line default
#line hidden
;
public class Imports
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public Imports()
{
}
public override void Execute()
{
__o =
#line 5 "Imports.cshtml"
__o = typeof(Foo).FullName;
typeof(Path).FullName
#line default
#line hidden
}
}
;
__o =
#line 6 "Imports.cshtml"
typeof(Foo).FullName
#line default
#line hidden
;
}
}
}

View File

@ -1,58 +1,45 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
#line 3 "Imports.cshtml"
using System;
#line default
#line hidden
namespace TestOutput
{
#line 1 "Imports.cshtml"
using System.IO;
using System.IO
#line default
#line hidden
;
#line 2 "Imports.cshtml"
using Foo = System.Text.Encoding;
using Foo = System.Text.Encoding
#line default
#line hidden
public class Imports {
;
#line 3 "Imports.cshtml"
using System
#line default
#line hidden
public Imports() {
}
public override void Execute() {
WriteLiteral("\r\n<p>Path\'s full type name is ");
;
public class Imports
{
#line hidden
public Imports()
{
}
public override void Execute()
{
WriteLiteral("\r\n<p>Path\'s full type name is ");
Write(
#line 5 "Imports.cshtml"
Write(typeof(Path).FullName);
typeof(Path).FullName
#line default
#line hidden
WriteLiteral("</p>\r\n<p>Foo\'s actual full type name is ");
);
WriteLiteral("</p>\r\n<p>Foo\'s actual full type name is ");
Write(
#line 6 "Imports.cshtml"
Write(typeof(Foo).FullName);
typeof(Foo).FullName
#line default
#line hidden
WriteLiteral("</p>");
}
}
);
WriteLiteral("</p>");
}
}
}

View File

@ -1,40 +1,32 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Inherits : foo.bar<baz<biz>>.boz bar {
private static object @__o;
#line hidden
public Inherits() {
}
private void @__RazorDesignTimeHelpers__() {
#pragma warning disable 219
#line 2 "Inherits.cshtml"
public class Inherits : foo.bar<baz<biz>>.boz bar
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#line 3 "Inherits.cshtml"
foo.bar<baz<biz>>.boz bar __inheritsHelper = null;
#line default
#line hidden
#pragma warning restore 219
}
public override void Execute() {
#pragma warning restore 219
}
#line hidden
public Inherits()
{
}
public override void Execute()
{
__o =
#line 1 "Inherits.cshtml"
__o = foo();
foo()
#line default
#line hidden
}
}
;
}
}
}

View File

@ -1,30 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Inherits : foo.bar<baz<biz>>.boz bar {
#line hidden
public Inherits() {
}
public override void Execute() {
public class Inherits : foo.bar<baz<biz>>.boz bar
{
#line hidden
public Inherits()
{
}
public override void Execute()
{
Write(
#line 1 "Inherits.cshtml"
Write(foo());
foo()
#line default
#line hidden
WriteLiteral("\r\n\r\n");
}
}
);
WriteLiteral("\r\n\r\n");
}
}
}

View File

@ -1,87 +1,66 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class InlineBlocks {
#line hidden
public class InlineBlocks
{
public static Template
#line 1 "InlineBlocks.cshtml"
public static Template Link(string link) {
Link(string link) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "InlineBlocks.cshtml"
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <a");
WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 35), Tuple.Create("\"", 93)
, Tuple.Create(Tuple.Create("", 42), Tuple.Create<System.Object, System.Int32>(new Template(__razor_attribute_value_writer => {
WriteLiteralTo(__razor_helper_writer, " <a");
WriteAttributeTo(__razor_helper_writer, "href", Tuple.Create(" href=\"", 35), Tuple.Create("\"", 93),
Tuple.Create(Tuple.Create("", 42), Tuple.Create<System.Object, System.Int32>(new Template((__razor_attribute_value_writer) => {
#line 2 "InlineBlocks.cshtml"
if(link != null) {
#line default
#line hidden
WriteTo(__razor_attribute_value_writer,
#line 2 "InlineBlocks.cshtml"
WriteTo(__razor_attribute_value_writer, link);
link
#line default
#line hidden
);
#line 2 "InlineBlocks.cshtml"
} else {
#line default
#line hidden
WriteLiteralTo(__razor_attribute_value_writer, " ");
WriteLiteralTo(__razor_attribute_value_writer, "#");
WriteLiteralTo(__razor_attribute_value_writer, " ");
WriteLiteralTo(__razor_attribute_value_writer, " # ");
#line 2 "InlineBlocks.cshtml"
}
#line default
#line hidden
}), 42), false)
);
WriteLiteralTo(__razor_helper_writer, " />\r\n");
}
), 42), false));
WriteLiteralTo(__razor_helper_writer, " />\r\n");
#line 3 "InlineBlocks.cshtml"
#line default
#line hidden
});
}
);
#line 3 "InlineBlocks.cshtml"
}
#line default
#line hidden
public InlineBlocks() {
}
public override void Execute() {
}
}
#line hidden
public InlineBlocks()
{
}
public override void Execute()
{
}
}
}

View File

@ -1,359 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class Instrumented {
#line hidden
#line 1 "Instrumented.cshtml"
public static Template Strong(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
#line 1 "Instrumented.cshtml"
#line default
#line hidden
BeginContext(__razor_helper_writer, "~/Instrumented.cshtml", 28, 12, true);
WriteLiteralTo(__razor_helper_writer, " <strong>");
EndContext(__razor_helper_writer, "~/Instrumented.cshtml", 28, 12, true);
BeginContext(__razor_helper_writer, "~/Instrumented.cshtml", 41, 1, false);
#line 2 "Instrumented.cshtml"
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
EndContext(__razor_helper_writer, "~/Instrumented.cshtml", 41, 1, false);
BeginContext(__razor_helper_writer, "~/Instrumented.cshtml", 42, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
EndContext(__razor_helper_writer, "~/Instrumented.cshtml", 42, 11, true);
#line 3 "Instrumented.cshtml"
#line default
#line hidden
});
#line 3 "Instrumented.cshtml"
}
#line default
#line hidden
public Instrumented() {
}
public override void Execute() {
BeginContext("~/Instrumented.cshtml", 56, 2, true);
WriteLiteral("\r\n");
EndContext("~/Instrumented.cshtml", 56, 2, true);
#line 5 "Instrumented.cshtml"
int i = 1;
var foo =
#line default
#line hidden
item => new Template(__razor_template_writer => {
BeginContext(__razor_template_writer, "~/Instrumented.cshtml", 93, 10, true);
WriteLiteralTo(__razor_template_writer, "<p>Bar</p>");
EndContext(__razor_template_writer, "~/Instrumented.cshtml", 93, 10, true);
})
#line 7 "Instrumented.cshtml"
;
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 106, 4, true);
WriteLiteral(" ");
EndContext("~/Instrumented.cshtml", 106, 4, true);
BeginContext("~/Instrumented.cshtml", 112, 14, true);
WriteLiteral("Hello, World\r\n");
EndContext("~/Instrumented.cshtml", 112, 14, true);
BeginContext("~/Instrumented.cshtml", 126, 25, true);
WriteLiteral(" <p>Hello, World</p>\r\n");
EndContext("~/Instrumented.cshtml", 126, 25, true);
#line 10 "Instrumented.cshtml"
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 152, 4, true);
WriteLiteral("\r\n\r\n");
EndContext("~/Instrumented.cshtml", 152, 4, true);
#line 12 "Instrumented.cshtml"
while(i <= 10) {
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 175, 23, true);
WriteLiteral(" <p>Hello from C#, #");
EndContext("~/Instrumented.cshtml", 175, 23, true);
BeginContext("~/Instrumented.cshtml", 200, 1, false);
#line 13 "Instrumented.cshtml"
Write(i);
#line default
#line hidden
EndContext("~/Instrumented.cshtml", 200, 1, false);
BeginContext("~/Instrumented.cshtml", 202, 6, true);
WriteLiteral("</p>\r\n");
EndContext("~/Instrumented.cshtml", 202, 6, true);
#line 14 "Instrumented.cshtml"
i += 1;
}
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 224, 2, true);
WriteLiteral("\r\n");
EndContext("~/Instrumented.cshtml", 224, 2, true);
#line 17 "Instrumented.cshtml"
if(i == 11) {
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 242, 31, true);
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
EndContext("~/Instrumented.cshtml", 242, 31, true);
#line 19 "Instrumented.cshtml"
}
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 276, 2, true);
WriteLiteral("\r\n");
EndContext("~/Instrumented.cshtml", 276, 2, true);
#line 21 "Instrumented.cshtml"
switch(i) {
case 11:
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 306, 46, true);
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
EndContext("~/Instrumented.cshtml", 306, 46, true);
#line 24 "Instrumented.cshtml"
break;
default:
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 382, 39, true);
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
EndContext("~/Instrumented.cshtml", 382, 39, true);
#line 27 "Instrumented.cshtml"
break;
}
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 440, 2, true);
WriteLiteral("\r\n");
EndContext("~/Instrumented.cshtml", 440, 2, true);
#line 30 "Instrumented.cshtml"
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 478, 29, true);
WriteLiteral(" <p>Hello again from C#, #");
EndContext("~/Instrumented.cshtml", 478, 29, true);
BeginContext("~/Instrumented.cshtml", 509, 1, false);
#line 31 "Instrumented.cshtml"
Write(j);
#line default
#line hidden
EndContext("~/Instrumented.cshtml", 509, 1, false);
BeginContext("~/Instrumented.cshtml", 511, 6, true);
WriteLiteral("</p>\r\n");
EndContext("~/Instrumented.cshtml", 511, 6, true);
#line 32 "Instrumented.cshtml"
}
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 520, 2, true);
WriteLiteral("\r\n");
EndContext("~/Instrumented.cshtml", 520, 2, true);
#line 34 "Instrumented.cshtml"
try {
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 530, 41, true);
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
EndContext("~/Instrumented.cshtml", 530, 41, true);
#line 36 "Instrumented.cshtml"
} catch(Exception ex) {
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 596, 33, true);
WriteLiteral(" <p>Oh no! An error occurred: ");
EndContext("~/Instrumented.cshtml", 596, 33, true);
BeginContext("~/Instrumented.cshtml", 631, 10, false);
#line 37 "Instrumented.cshtml"
Write(ex.Message);
#line default
#line hidden
EndContext("~/Instrumented.cshtml", 631, 10, false);
BeginContext("~/Instrumented.cshtml", 642, 6, true);
WriteLiteral("</p>\r\n");
EndContext("~/Instrumented.cshtml", 642, 6, true);
#line 38 "Instrumented.cshtml"
}
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 651, 2, true);
WriteLiteral("\r\n");
EndContext("~/Instrumented.cshtml", 651, 2, true);
#line 40 "Instrumented.cshtml"
lock(new object()) {
#line default
#line hidden
BeginContext("~/Instrumented.cshtml", 676, 53, true);
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
EndContext("~/Instrumented.cshtml", 676, 53, true);
#line 42 "Instrumented.cshtml"
}
#line default
#line hidden
}
}
}

View File

@ -1,22 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class LayoutDirective
{
#line hidden
public LayoutDirective()
{
}
public class LayoutDirective {
#line hidden
public LayoutDirective() {
}
public override void Execute() {
Layout = "~/Foo/Bar/Baz";
}
}
public override void Execute()
{
Layout = "~/Foo/Bar/Baz";
}
}
}

View File

@ -1,49 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class MarkupInCodeBlock {
#line hidden
public MarkupInCodeBlock() {
}
public override void Execute() {
public class MarkupInCodeBlock
{
#line hidden
public MarkupInCodeBlock()
{
}
public override void Execute()
{
#line 1 "MarkupInCodeBlock.cshtml"
for(int i = 1; i <= 10; i++) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
WriteLiteral(" <p>Hello from C#, #");
Write(
#line 3 "MarkupInCodeBlock.cshtml"
Write(i.ToString());
i.ToString()
#line default
#line hidden
WriteLiteral("</p>\r\n");
);
WriteLiteral("</p>\r\n");
#line 4 "MarkupInCodeBlock.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
}
}
WriteLiteral("\r\n");
}
}
}

View File

@ -1,42 +1,34 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class NestedCodeBlocks {
#line hidden
public NestedCodeBlocks() {
}
public override void Execute() {
public class NestedCodeBlocks
{
#line hidden
public NestedCodeBlocks()
{
}
public override void Execute()
{
#line 1 "NestedCodeBlocks.cshtml"
if(foo) {
#line default
#line hidden
#line 2 "NestedCodeBlocks.cshtml"
if(bar) {
}
#line default
#line hidden
#line 3 "NestedCodeBlocks.cshtml"
}
#line default
#line hidden
}
}
}
}
}

View File

@ -1,111 +1,92 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class NestedHelpers {
#line hidden
#line 3 "NestedHelpers.cshtml"
public static Template Bold(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
#line 3 "NestedHelpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
#line 5 "NestedHelpers.cshtml"
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 6 "NestedHelpers.cshtml"
#line default
#line hidden
});
#line 6 "NestedHelpers.cshtml"
}
#line default
#line hidden
namespace TestOutput
{
using System;
public class NestedHelpers
{
public static Template
#line 1 "NestedHelpers.cshtml"
public static Template Italic(string s) {
Italic(string s) {
#line default
#line hidden
return new Template(__razor_helper_writer => {
return new Template((__razor_helper_writer) => {
#line 1 "NestedHelpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
#line 6 "NestedHelpers.cshtml"
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <em>");
WriteLiteralTo(__razor_helper_writer, " <em>");
WriteTo(__razor_helper_writer,
#line 7 "NestedHelpers.cshtml"
WriteTo(__razor_helper_writer, Bold(s));
Bold(s)
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
#line 8 "NestedHelpers.cshtml"
#line default
#line hidden
});
}
);
#line 8 "NestedHelpers.cshtml"
}
#line default
#line hidden
public NestedHelpers() {
public static Template
#line 3 "NestedHelpers.cshtml"
Bold(string s) {
#line default
#line hidden
return new Template((__razor_helper_writer) => {
#line 3 "NestedHelpers.cshtml"
s = s.ToUpper();
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <strong>");
WriteTo(__razor_helper_writer,
#line 5 "NestedHelpers.cshtml"
s
#line default
#line hidden
);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
#line 6 "NestedHelpers.cshtml"
#line default
#line hidden
}
);
#line 6 "NestedHelpers.cshtml"
}
public override void Execute() {
WriteLiteral("\r\n");
#line default
#line hidden
#line hidden
public NestedHelpers()
{
}
public override void Execute()
{
WriteLiteral("\r\n");
Write(
#line 10 "NestedHelpers.cshtml"
Write(Italic("Hello"));
Italic("Hello")
#line default
#line hidden
}
}
);
}
}
}

View File

@ -1,102 +1,144 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class NoLinePragmas
{
#line hidden
public NoLinePragmas()
{
}
public class NoLinePragmas {
#line hidden
public NoLinePragmas() {
}
public override void Execute() {
public override void Execute()
{
#line 1 ""
int i = 1;
#line default
#line hidden
WriteLiteral("\r\n\r\n");
WriteLiteral("\r\n\r\n");
#line 5 ""
while(i <= 10) {
#line default
#line hidden
WriteLiteral(" <p>Hello from C#, #");
Write(i);
WriteLiteral("</p>\r\n");
WriteLiteral(" <p>Hello from C#, #");
Write(
#line 6 ""
i
#line default
#line hidden
);
WriteLiteral("</p>\r\n");
#line 7 ""
i += 1;
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 10 ""
if(i == 11) {
#line default
#line hidden
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
WriteLiteral(" <p>We wrote 10 lines!</p>\r\n");
#line 12 ""
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 14 ""
switch(i) {
case 11:
#line default
#line hidden
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
WriteLiteral(" <p>No really, we wrote 10 lines!</p>\r\n");
#line 17 ""
break;
default:
#line default
#line hidden
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
WriteLiteral(" <p>Actually, we didn\'t...</p>\r\n");
#line 20 ""
break;
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 23 ""
for(int j = 1; j <= 10; j += 2) {
#line default
#line hidden
WriteLiteral(" <p>Hello again from C#, #");
Write(j);
WriteLiteral("</p>\r\n");
WriteLiteral(" <p>Hello again from C#, #");
Write(
#line 24 ""
j
#line default
#line hidden
);
WriteLiteral("</p>\r\n");
#line 25 ""
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 27 ""
try {
#line default
#line hidden
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
WriteLiteral(" <p>That time, we wrote 5 lines!</p>\r\n");
#line 29 ""
} catch(Exception ex) {
#line default
#line hidden
WriteLiteral(" <p>Oh no! An error occurred: ");
Write(ex.Message);
WriteLiteral("</p>\r\n");
WriteLiteral(" <p>Oh no! An error occurred: ");
Write(
#line 30 ""
ex.Message
#line default
#line hidden
);
WriteLiteral("</p>\r\n");
#line 31 ""
}
#line default
#line hidden
#line 33 ""
#line default
#line hidden
WriteLiteral("<p>i is now ");
Write(i);
WriteLiteral("</p>\r\n\r\n");
WriteLiteral("<p>i is now ");
Write(
#line 34 ""
i
#line default
#line hidden
);
WriteLiteral("</p>\r\n\r\n");
#line 36 ""
lock(new object()) {
#line default
#line hidden
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
WriteLiteral(" <p>This block is locked, for your security!</p>\r\n");
#line 38 ""
}
#line default
#line hidden
}
}
}
}
}
}

View File

@ -1,41 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class OpenedIf {
#line hidden
public OpenedIf() {
}
public override void Execute() {
#line 1 "OpenedIf.cshtml"
if (true) {
#line default
#line hidden
#line 2 "OpenedIf.cshtml"
#line default
#line hidden
public class OpenedIf
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public OpenedIf()
{
}
public override void Execute()
{
#line 3 "OpenedIf.cshtml"
if (true) {
#line default
#line hidden
}
}
#line 4 "OpenedIf.cshtml"
#line default
#line hidden
#line 5 "OpenedIf.cshtml"
#line default
#line hidden
}
}
}

View File

@ -1,41 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class OpenedIf {
#line hidden
public OpenedIf() {
}
public override void Execute() {
#line 1 "OpenedIf.cshtml"
if (true) {
#line default
#line hidden
#line 2 "OpenedIf.cshtml"
#line default
#line hidden
public class OpenedIf
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public OpenedIf()
{
}
public override void Execute()
{
#line 3 "OpenedIf.cshtml"
if (true) {
#line default
#line hidden
}
}
#line 4 "OpenedIf.cshtml"
#line default
#line hidden
#line 5 "OpenedIf.cshtml"
#line default
#line hidden
}
}
}

View File

@ -1,31 +1,31 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class ParserError {
#line hidden
public ParserError() {
}
public override void Execute() {
public class ParserError
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public ParserError()
{
}
public override void Execute()
{
#line 1 "ParserError.cshtml"
/*
int i =10;
int j =20;
}
#line default
#line hidden
}
}
}
}
}

View File

@ -1,72 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class RazorComments
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public RazorComments()
{
}
public class RazorComments {
private static object @__o;
#line hidden
public RazorComments() {
}
public override void Execute() {
#line 1 "RazorComments.cshtml"
public override void Execute()
{
#line 4 "RazorComments.cshtml"
#line default
#line hidden
#line 2 "RazorComments.cshtml"
Exception foo =
#line default
#line hidden
#line 3 "RazorComments.cshtml"
null;
if(foo != null) {
throw foo;
}
#line default
#line hidden
#line 4 "RazorComments.cshtml"
var bar = "@* bar *@";
#line default
#line hidden
#line 5 "RazorComments.cshtml"
__o = bar;
Exception foo =
#line default
#line hidden
#line 6 "RazorComments.cshtml"
__o = a
null;
if(foo != null) {
throw foo;
}
#line default
#line hidden
#line 7 "RazorComments.cshtml"
b;
#line 12 "RazorComments.cshtml"
var bar = "@* bar *@";
#line default
#line hidden
}
}
__o =
#line 13 "RazorComments.cshtml"
bar
#line default
#line hidden
;
__o =
#line 15 "RazorComments.cshtml"
a
#line default
#line hidden
#line 15 "RazorComments.cshtml"
b
#line default
#line hidden
;
}
}
}

View File

@ -1,37 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput {
using System;
public class RazorComments {
#line hidden
public RazorComments() {
}
public override void Execute() {
WriteLiteral("\r\n<p>This should ");
WriteLiteral(" be shown</p>\r\n\r\n");
namespace TestOutput
{
using System;
public class RazorComments
{
#line hidden
public RazorComments()
{
}
public override void Execute()
{
WriteLiteral("\r\n<p>This should be shown</p>\r\n\r\n");
#line 4 "RazorComments.cshtml"
#line default
#line hidden
#line 5 "RazorComments.cshtml"
Exception foo =
#line default
#line hidden
@ -40,44 +29,34 @@ WriteLiteral(" be shown</p>\r\n\r\n");
if(foo != null) {
throw foo;
}
#line default
#line hidden
WriteLiteral("\r\n\r\n");
WriteLiteral("\r\n\r\n");
#line 12 "RazorComments.cshtml"
var bar = "@* bar *@";
#line default
#line hidden
WriteLiteral("\r\n<p>But this should show the comment syntax: ");
WriteLiteral("\r\n<p>But this should show the comment syntax: ");
Write(
#line 13 "RazorComments.cshtml"
Write(bar);
bar
#line default
#line hidden
WriteLiteral("</p>\r\n\r\n");
);
WriteLiteral("</p>\r\n\r\n");
Write(
#line 15 "RazorComments.cshtml"
Write(a
a
#line default
#line hidden
#line 15 "RazorComments.cshtml"
b);
b
#line default
#line hidden
WriteLiteral("\r\n");
}
}
);
WriteLiteral("\r\n");
}
}
}

View File

@ -1,230 +1,131 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class ResolveUrl {
#line hidden
public ResolveUrl() {
}
public override void Execute() {
WriteLiteral("<a");
WriteAttribute("href", Tuple.Create(" href=\"", 2), Tuple.Create("\"", 14)
, Tuple.Create(Tuple.Create("", 9), Tuple.Create<System.Object, System.Int32>(Href("~/Foo")
, 9), false)
);
WriteLiteral(">Foo</a>\r\n<a");
WriteAttribute("href", Tuple.Create(" href=\"", 27), Tuple.Create("\"", 56)
, Tuple.Create(Tuple.Create("", 34), Tuple.Create<System.Object, System.Int32>(Href("~/Products/")
, 34), false)
public class ResolveUrl
{
#line hidden
public ResolveUrl()
{
}
public override void Execute()
{
WriteLiteral("<a");
WriteAttribute("href", Tuple.Create(" href=\"", 2), Tuple.Create("\"", 14), Tuple.Create(Tuple.Create("", 9), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 9), false));
WriteLiteral(">Foo</a>\r\n<a");
WriteAttribute("href", Tuple.Create(" href=\"", 27), Tuple.Create("\"", 56), Tuple.Create(Tuple.Create("", 34), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 34), false),
Tuple.Create(Tuple.Create("", 45), Tuple.Create<System.Object, System.Int32>(
#line 2 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 45), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 45), false)
);
WriteLiteral(">");
, 45), false));
WriteLiteral(">");
Write(
#line 2 "ResolveUrl.cshtml"
Write(product.Name);
product.Name
#line default
#line hidden
WriteLiteral("</a>\r\n<a");
WriteAttribute("href", Tuple.Create(" href=\"", 79), Tuple.Create("\"", 115)
, Tuple.Create(Tuple.Create("", 86), Tuple.Create<System.Object, System.Int32>(Href("~/Products/")
, 86), false)
);
WriteLiteral("</a>\r\n<a");
WriteAttribute("href", Tuple.Create(" href=\"", 79), Tuple.Create("\"", 115), Tuple.Create(Tuple.Create("", 86), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 86), false),
Tuple.Create(Tuple.Create("", 97), Tuple.Create<System.Object, System.Int32>(
#line 3 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 97), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 97), false)
, Tuple.Create(Tuple.Create("", 108), Tuple.Create("/Detail", 108), true)
);
WriteLiteral(">Details</a>\r\n<a");
WriteAttribute("href", Tuple.Create(" href=\"", 132), Tuple.Create("\"", 187)
, Tuple.Create(Tuple.Create("", 139), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/")
, 139), false)
, 97), false), Tuple.Create(Tuple.Create("", 108), Tuple.Create("/Detail", 108), true));
WriteLiteral(">Details</a>\r\n<a");
WriteAttribute("href", Tuple.Create(" href=\"", 132), Tuple.Create("\"", 187), Tuple.Create(Tuple.Create("", 139), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 139), false),
Tuple.Create(Tuple.Create("", 169), Tuple.Create<System.Object, System.Int32>(
#line 4 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 169), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 169), false)
, Tuple.Create(Tuple.Create("", 180), Tuple.Create("/Detail", 180), true)
);
WriteLiteral(">Crazy Url!</a>\r\n\r\n");
, 169), false), Tuple.Create(Tuple.Create("", 180), Tuple.Create("/Detail", 180), true));
WriteLiteral(">Crazy Url!</a>\r\n\r\n");
#line 6 "ResolveUrl.cshtml"
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 233), Tuple.Create("\"", 245)
, Tuple.Create(Tuple.Create("", 240), Tuple.Create<System.Object, System.Int32>(Href("~/Foo")
, 240), false)
);
WriteLiteral(">Foo</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 266), Tuple.Create("\"", 295)
, Tuple.Create(Tuple.Create("", 273), Tuple.Create<System.Object, System.Int32>(Href("~/Products/")
, 273), false)
WriteLiteral(" \r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 233), Tuple.Create("\"", 245), Tuple.Create(Tuple.Create("", 240), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 240), false));
WriteLiteral(">Foo</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 266), Tuple.Create("\"", 295), Tuple.Create(Tuple.Create("", 273), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 273), false),
Tuple.Create(Tuple.Create("", 284), Tuple.Create<System.Object, System.Int32>(
#line 9 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 284), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 284), false)
);
WriteLiteral(">");
, 284), false));
WriteLiteral(">");
Write(
#line 9 "ResolveUrl.cshtml"
Write(product.Name);
product.Name
#line default
#line hidden
WriteLiteral("</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 326), Tuple.Create("\"", 362)
, Tuple.Create(Tuple.Create("", 333), Tuple.Create<System.Object, System.Int32>(Href("~/Products/")
, 333), false)
);
WriteLiteral("</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 326), Tuple.Create("\"", 362), Tuple.Create(Tuple.Create("", 333), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 333), false),
Tuple.Create(Tuple.Create("", 344), Tuple.Create<System.Object, System.Int32>(
#line 10 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 344), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 344), false)
, Tuple.Create(Tuple.Create("", 355), Tuple.Create("/Detail", 355), true)
);
WriteLiteral(">Details</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 387), Tuple.Create("\"", 442)
, Tuple.Create(Tuple.Create("", 394), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/")
, 394), false)
, 344), false), Tuple.Create(Tuple.Create("", 355), Tuple.Create("/Detail", 355), true));
WriteLiteral(">Details</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 387), Tuple.Create("\"", 442), Tuple.Create(Tuple.Create("", 394), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 394), false),
Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(
#line 11 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 424), false)
, Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true)
);
WriteLiteral(">Crazy Url!</a>\r\n ");
WriteLiteral("\r\n");
, 424), false), Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true));
WriteLiteral(">Crazy Url!</a>\r\n \r\n");
#line 13 "ResolveUrl.cshtml"
#line default
#line hidden
WriteLiteral("\r\n\r\n");
DefineSection("Foo", () => {
WriteLiteral("\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 500), Tuple.Create("\"", 512)
, Tuple.Create(Tuple.Create("", 507), Tuple.Create<System.Object, System.Int32>(Href("~/Foo")
, 507), false)
);
WriteLiteral(">Foo</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 529), Tuple.Create("\"", 558)
, Tuple.Create(Tuple.Create("", 536), Tuple.Create<System.Object, System.Int32>(Href("~/Products/")
, 536), false)
WriteLiteral("\r\n\r\n");
DefineSection("Foo", () => {
WriteLiteral("\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 500), Tuple.Create("\"", 512), Tuple.Create(Tuple.Create("", 507), Tuple.Create<System.Object, System.Int32>(Href("~/Foo"), 507), false));
WriteLiteral(">Foo</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 529), Tuple.Create("\"", 558), Tuple.Create(Tuple.Create("", 536), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 536), false),
Tuple.Create(Tuple.Create("", 547), Tuple.Create<System.Object, System.Int32>(
#line 17 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 547), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 547), false)
);
WriteLiteral(">");
, 547), false));
WriteLiteral(">");
Write(
#line 17 "ResolveUrl.cshtml"
Write(product.Name);
product.Name
#line default
#line hidden
WriteLiteral("</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 585), Tuple.Create("\"", 621)
, Tuple.Create(Tuple.Create("", 592), Tuple.Create<System.Object, System.Int32>(Href("~/Products/")
, 592), false)
);
WriteLiteral("</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 585), Tuple.Create("\"", 621), Tuple.Create(Tuple.Create("", 592), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 592), false),
Tuple.Create(Tuple.Create("", 603), Tuple.Create<System.Object, System.Int32>(
#line 18 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 603), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 603), false)
, Tuple.Create(Tuple.Create("", 614), Tuple.Create("/Detail", 614), true)
);
WriteLiteral(">Details</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 642), Tuple.Create("\"", 697)
, Tuple.Create(Tuple.Create("", 649), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/")
, 649), false)
, 603), false), Tuple.Create(Tuple.Create("", 614), Tuple.Create("/Detail", 614), true));
WriteLiteral(">Details</a>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 642), Tuple.Create("\"", 697), Tuple.Create(Tuple.Create("", 649), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 649), false),
Tuple.Create(Tuple.Create("", 679), Tuple.Create<System.Object, System.Int32>(
#line 19 "ResolveUrl.cshtml"
, Tuple.Create(Tuple.Create("", 679), Tuple.Create<System.Object, System.Int32>(product.id
product.id
#line default
#line hidden
, 679), false)
, Tuple.Create(Tuple.Create("", 690), Tuple.Create("/Detail", 690), true)
);
WriteLiteral(">Crazy Url!</a>\r\n");
});
}
}
, 679), false), Tuple.Create(Tuple.Create("", 690), Tuple.Create("/Detail", 690), true));
WriteLiteral(">Crazy Url!</a>\r\n");
}
);
}
}
}

View File

@ -1,45 +1,32 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Sections {
#line hidden
public Sections() {
}
public override void Execute() {
public class Sections
{
#line hidden
public Sections()
{
}
public override void Execute()
{
#line 1 "Sections.cshtml"
Layout = "_SectionTestLayout.cshtml"
#line default
#line hidden
WriteLiteral("\r\n\r\n<div>This is in the Body>\r\n\r\n");
DefineSection("Section2", () => {
WriteLiteral("\r\n <div>This is in Section 2</div>\r\n");
});
WriteLiteral("\r\n");
DefineSection("Section1", () => {
WriteLiteral("\r\n <div>This is in Section 1</div>\r\n");
});
}
}
WriteLiteral("\r\n\r\n<div>This is in the Body>\r\n\r\n");
DefineSection("Section2", () => {
WriteLiteral("\r\n <div>This is in Section 2</div>\r\n");
}
);
WriteLiteral("\r\n");
DefineSection("Section1", () => {
WriteLiteral("\r\n <div>This is in Section 1</div>\r\n");
}
);
}
}
}

View File

@ -1,36 +1,35 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class SimpleUnspacedIf {
#line hidden
public SimpleUnspacedIf() {
}
public override void Execute() {
public class SimpleUnspacedIf
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public SimpleUnspacedIf()
{
}
public override void Execute()
{
#line 1 "SimpleUnspacedIf.cshtml"
if (true)
if (true)
{
#line default
#line hidden
#line 2 "SimpleUnspacedIf.cshtml"
#line 3 "SimpleUnspacedIf.cshtml"
}
#line default
#line hidden
}
}
}
}
}

View File

@ -1,18 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class Templates {
#line hidden
public class Templates
{
#line 1 "Templates.cshtml"
public HelperResult Repeat(int times, Func<int, object> template) {
@ -22,159 +13,130 @@ public class Templates {
}
});
}
#line default
#line hidden
#line hidden
public Templates()
{
}
public Templates() {
}
public override void Execute() {
WriteLiteral("\r\n");
public override void Execute()
{
WriteLiteral("\r\n");
#line 11 "Templates.cshtml"
Func<dynamic, object> foo =
#line default
#line hidden
item => new Template(__razor_template_writer => {
WriteLiteralTo(__razor_template_writer, "This works ");
item => new Template((__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "This works ");
WriteTo(__razor_template_writer,
#line 12 "Templates.cshtml"
WriteTo(__razor_template_writer, item);
item
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "!");
})
);
WriteLiteralTo(__razor_template_writer, "!");
}
)
#line 12 "Templates.cshtml"
;
#line default
#line hidden
Write(
#line 13 "Templates.cshtml"
Write(foo(""));
foo("")
#line default
#line hidden
);
#line 13 "Templates.cshtml"
#line default
#line hidden
WriteLiteral("\r\n\r\n<ul>\r\n");
WriteLiteral("\r\n\r\n<ul>\r\n");
Write(
#line 17 "Templates.cshtml"
Write(Repeat(10, item => new Template(__razor_template_writer => {
Repeat(10,
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "<li>Item #");
item => new Template((__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<li>Item #");
WriteTo(__razor_template_writer,
#line 17 "Templates.cshtml"
WriteTo(__razor_template_writer, item);
item
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "</li>");
);
WriteLiteralTo(__razor_template_writer, "</li>");
}
)
#line 17 "Templates.cshtml"
})));
)
#line default
#line hidden
WriteLiteral("\r\n</ul>\r\n\r\n<p>\r\n");
);
WriteLiteral("\r\n</ul>\r\n\r\n<p>\r\n");
Write(
#line 21 "Templates.cshtml"
Write(Repeat(10,
item => new Template(__razor_template_writer => {
Repeat(10,
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " This is line#");
item => new Template((__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, " This is line#");
WriteTo(__razor_template_writer,
#line 22 "Templates.cshtml"
WriteTo(__razor_template_writer, item);
item
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, " of markup<br/>\r\n");
);
WriteLiteralTo(__razor_template_writer, " of markup<br/>\r\n");
}
)
#line 23 "Templates.cshtml"
})));
)
#line default
#line hidden
WriteLiteral("\r\n</p>\r\n\r\n<ul>\r\n");
WriteLiteral(" ");
);
WriteLiteral("\r\n</p>\r\n\r\n<ul>\r\n ");
Write(
#line 27 "Templates.cshtml"
Write(Repeat(10, item => new Template(__razor_template_writer => {
Repeat(10,
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "<li>\r\n Item #");
item => new Template((__razor_template_writer) => {
WriteLiteralTo(__razor_template_writer, "<li>\r\n Item #");
WriteTo(__razor_template_writer,
#line 28 "Templates.cshtml"
WriteTo(__razor_template_writer, item);
item
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "\r\n");
);
WriteLiteralTo(__razor_template_writer, "\r\n");
#line 29 "Templates.cshtml"
#line default
#line hidden
#line 29 "Templates.cshtml"
var parent = item;
#line default
#line hidden
WriteLiteralTo(__razor_template_writer, "\r\n <ul>\r\n <li>Child Items... ?</li>\r\n ");
WriteLiteralTo(__razor_template_writer, "\r\n </ul>\r\n </li>");
WriteLiteralTo(__razor_template_writer, "\r\n <ul>\r\n <li>Child Items... ?</li>\r\n \r\n </ul" +
">\r\n </li>");
}
)
#line 34 "Templates.cshtml"
})));
)
#line default
#line hidden
WriteLiteral("\r\n</ul> ");
}
}
);
WriteLiteral("\r\n</ul> ");
}
}
}

View File

@ -1,43 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class UnfinishedExpressionInCode {
private static object @__o;
#line hidden
public UnfinishedExpressionInCode() {
}
public override void Execute() {
public class UnfinishedExpressionInCode
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public UnfinishedExpressionInCode()
{
}
public override void Execute()
{
#line 1 "UnfinishedExpressionInCode.cshtml"
#line default
#line hidden
__o =
#line 2 "UnfinishedExpressionInCode.cshtml"
__o = DateTime.;
DateTime.
#line default
#line hidden
#line 3 "UnfinishedExpressionInCode.cshtml"
;
#line 2 "UnfinishedExpressionInCode.cshtml"
#line default
#line hidden
}
}
}
}
}

View File

@ -1,43 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestOutput
{
using System;
namespace TestOutput {
using System;
public class UnfinishedExpressionInCode {
private static object @__o;
#line hidden
public UnfinishedExpressionInCode() {
}
public override void Execute() {
public class UnfinishedExpressionInCode
{
private static object @__o;
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
#line hidden
public UnfinishedExpressionInCode()
{
}
public override void Execute()
{
#line 1 "UnfinishedExpressionInCode.cshtml"
#line default
#line hidden
__o =
#line 2 "UnfinishedExpressionInCode.cshtml"
__o = DateTime.;
DateTime.
#line default
#line hidden
#line 3 "UnfinishedExpressionInCode.cshtml"
;
#line 2 "UnfinishedExpressionInCode.cshtml"
#line default
#line hidden
}
}
}
}
}

View File

@ -1,15 +1 @@
@{
var ch = true;
var cls = "bar";
<a href="Foo" />
<p class="@cls" />
<p class="foo @cls" />
<p class="@cls foo" />
<input type="checkbox" checked="@ch" />
<input type="checkbox" checked="foo @ch" />
<p class="@if (cls != null) { @cls } />
<a href="~/Foo" />
<script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
}


View File

@ -1,42 +0,0 @@
@helper Strong(string s) {
<strong>@s</strong>
}
@{
int i = 1;
var foo = @<p>Bar</p>;
@:Hello, World
<p>Hello, World</p>
}
@while(i <= 10) {
<p>Hello from C#, #@(i)</p>
i += 1;
}
@if(i == 11) {
<p>We wrote 10 lines!</p>
}
@switch(i) {
case 11:
<p>No really, we wrote 10 lines!</p>
break;
default:
<p>Actually, we didn't...</p>
break;
}
@for(int j = 1; j <= 10; j += 2) {
<p>Hello again from C#, #@(j)</p>
}
@try {
<p>That time, we wrote 5 lines!</p>
} catch(Exception ex) {
<p>Oh no! An error occurred: @(ex.Message)</p>
}
@lock(new object()) {
<p>This block is locked, for your security!</p>
}

View File

@ -1,60 +1,49 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:N.N.NNNNN.N
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Razor
{
namespace Razor {
public class @__CompiledTemplate {
public class __CompiledTemplate
{
private static object @__o;
#line hidden
public @__CompiledTemplate() {
private void @__RazorDesignTimeHelpers__()
{
#pragma warning disable 219
#pragma warning restore 219
}
public override void Execute() {
#line 1 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
#line hidden
public __CompiledTemplate()
{
}
public override void Execute()
{
#line 1 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
string hello = "Hello, World";
#line default
#line hidden
#line default
#line hidden
#line 2 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
__o = hello;
__o =
#line 11 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
hello
#line default
#line hidden
;
#line 13 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
foreach(char c in hello) {
#line default
#line hidden
#line default
#line hidden
#line 3 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
foreach(char c in hello) {
#line default
#line hidden
#line 4 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
__o = c;
#line default
#line hidden
#line 5 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
__o =
#line 13 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
c
#line default
#line hidden
;
#line 13 "C:\This\Path\Is\Just\For\Line\Pragmas.cshtml"
}
#line default
#line hidden
#line default
#line hidden
}
}
}

View File

@ -1,20 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
namespace Microsoft.AspNet.Razor.Test.Utils
{
public static class EnumerableUtils
{
public static void RunPairwise<T, V>(IEnumerable<T> left, IEnumerable<V> right, Action<T, V> action)
{
IEnumerator<T> leftEnum = left.GetEnumerator();
IEnumerator<V> rightEnum = right.GetEnumerator();
while (leftEnum.MoveNext() && rightEnum.MoveNext())
{
action(leftEnum.Current, rightEnum.Current);
}
}
}
}

View File

@ -1,34 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Linq.Expressions;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Utils
{
public static class MiscAssert
{
public static void AssertBothNullOrPropertyEqual<T>(T expected, T actual, Expression<Func<T, object>> propertyExpr, string objectName)
{
// Unpack convert expressions
Expression expr = propertyExpr.Body;
while (expr.NodeType == ExpressionType.Convert)
{
expr = ((UnaryExpression)expr).Operand;
}
string propertyName = ((MemberExpression)expr).Member.Name;
Func<T, object> property = propertyExpr.Compile();
if (expected == null)
{
Assert.Null(actual);
}
else
{
Assert.NotNull(actual);
Assert.Equal(property(expected), property(actual));
}
}
}
}

View File

@ -10,11 +10,6 @@ namespace Microsoft.AspNet.Razor.Test.Utils
{
public const int TimeoutInSeconds = 1;
public static string StripRuntimeVersion(string s)
{
return Regex.Replace(s, @"Runtime Version:[\d.]*", "Runtime Version:N.N.NNNNN.N");
}
public static void DoWithTimeoutIfNotDebugging(Func<int, bool> withTimeout)
{
#if DEBUG

View File

@ -1,59 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon;
namespace Microsoft.AspNet.Razor.Test.Utils
{
public static class EventAssert
{
public static void NoMoreSpans(IEnumerator<Span> enumerator)
{
IList<Span> tokens = new List<Span>();
while (enumerator.MoveNext())
{
tokens.Add(enumerator.Current);
}
Assert.False(tokens.Count > 0, String.Format(CultureInfo.InvariantCulture, @"There are more tokens available from the source: {0}", FormatList(tokens)));
}
private static string FormatList<T>(IList<T> items)
{
StringBuilder tokenString = new StringBuilder();
foreach (T item in items)
{
tokenString.AppendLine(item.ToString());
}
return tokenString.ToString();
}
public static void NextSpanIs(IEnumerator<Span> enumerator, SpanKind type, string content, SourceLocation location)
{
Assert.True(enumerator.MoveNext(), "There is no next token!");
IsSpan(enumerator.Current, type, content, location);
}
public static void NextSpanIs(IEnumerator<Span> enumerator, SpanKind type, string content, int actualIndex, int lineIndex, int charIndex)
{
NextSpanIs(enumerator, type, content, new SourceLocation(actualIndex, lineIndex, charIndex));
}
public static void IsSpan(Span tok, SpanKind type, string content, int actualIndex, int lineIndex, int charIndex)
{
IsSpan(tok, type, content, new SourceLocation(actualIndex, lineIndex, charIndex));
}
public static void IsSpan(Span tok, SpanKind type, string content, SourceLocation location)
{
Assert.Equal(content, tok.Content);
Assert.Equal(type, tok.Kind);
Assert.Equal(location, tok.Start);
}
}
}