Rename parser tests to have shorter names
This commit is contained in:
parent
7f6b05149d
commit
8e667ba730
|
|
@ -9,20 +9,21 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpBlockTest : CsHtmlCodeParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlock_NestedCodeBlockWithCSharpAt()
|
||||
public void NestedCodeBlockWithCSharpAt()
|
||||
{
|
||||
ParseBlockTest("{ if (true) { var val = @x; if (val != 3) { } } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_NestedCodeBlockWithMarkupSetsDotAsMarkup()
|
||||
public void NestedCodeBlockWithMarkupSetsDotAsMarkup()
|
||||
{
|
||||
ParseBlockTest("if (true) { @if(false) { <div>@something.</div> } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideSingleLineComments()
|
||||
public void BalancingBracketsIgnoresStringLiteralCharactersAndBrackets()
|
||||
{
|
||||
// BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideSingleLineComments
|
||||
SingleSpanBlockTest(@"if(foo) {
|
||||
// bar } "" baz '
|
||||
zoop();
|
||||
|
|
@ -46,102 +47,107 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsForKeyword()
|
||||
public void SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsForKeyword
|
||||
SingleSpanBlockTest(
|
||||
"for(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsForeachKeyword()
|
||||
public void SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsForeachKeyword
|
||||
SingleSpanBlockTest(
|
||||
"foreach(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsWhileKeyword()
|
||||
public void SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsWhileKeyword
|
||||
SingleSpanBlockTest(
|
||||
"while(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsUsingKeywordFollowedByParen()
|
||||
public void SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsUsingKeywordFollowedByParen
|
||||
SingleSpanBlockTest(
|
||||
"using(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsUsingsNestedWithinOtherBlocks()
|
||||
public void SupportsUsingsNestedWithinOtherBlocks()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"if(foo) { using(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches()
|
||||
public void SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches
|
||||
SingleSpanBlockTest(
|
||||
"if(int i = 0; i < 10; new Foo { Bar = \"baz\" }) { Debug.WriteLine(@\"foo } bar\"); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsEmptyBlockStatement()
|
||||
public void AllowsEmptyBlockStatement()
|
||||
{
|
||||
SingleSpanBlockTest("if(false) { }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesParenBalancingAtEOF()
|
||||
public void TerminatesParenBalancingAtEOF()
|
||||
{
|
||||
ImplicitExpressionTest("Html.En(code()");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenIfAndElseClause()
|
||||
public void SupportsBlockCommentBetweenIfAndElseClause()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenIfAndElseClause()
|
||||
public void SupportsRazorCommentBetweenIfAndElseClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest(
|
||||
"if(foo) { bar(); } ", " else { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenElseIfAndElseClause()
|
||||
public void SupportsBlockCommentBetweenElseIfAndElseClause()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenElseIfAndElseClause()
|
||||
public void SupportsRazorCommentBetweenElseIfAndElseClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest(
|
||||
"if(foo) { bar(); } else if(bar) { baz(); } ", " else { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenIfAndElseIfClause()
|
||||
public void SupportsBlockCommentBetweenIfAndElseIfClause()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenIfAndElseIfClause()
|
||||
public void SupportsRazorCommentBetweenIfAndElseIfClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest("if(foo) { bar(); } ", " else if(bar) { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenIfAndElseClause()
|
||||
public void SupportsLineCommentBetweenIfAndElseClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"if(foo) { bar(); }
|
||||
// Foo
|
||||
|
|
@ -150,7 +156,7 @@ else { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenElseIfAndElseClause()
|
||||
public void SupportsLineCommentBetweenElseIfAndElseClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"if(foo) { bar(); } else if(bar) { baz(); }
|
||||
// Foo
|
||||
|
|
@ -159,7 +165,7 @@ else { biz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenIfAndElseIfClause()
|
||||
public void SupportsLineCommentBetweenIfAndElseIfClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"if(foo) { bar(); }
|
||||
// Foo
|
||||
|
|
@ -168,7 +174,7 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesElseIfBranchesOfIfStatement()
|
||||
public void ParsesElseIfBranchesOfIfStatement()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
|
|
@ -182,7 +188,7 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatement()
|
||||
public void ParsesMultipleElseIfBranchesOfIfStatement()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
|
|
@ -195,7 +201,7 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch()
|
||||
public void ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
|
|
@ -210,7 +216,7 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsParsingCodeAfterElseBranch()
|
||||
public void StopsParsingCodeAfterElseBranch()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
|
|
@ -225,7 +231,7 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsParsingIfIfStatementNotFollowedByElse()
|
||||
public void StopsParsingIfIfStatementNotFollowedByElse()
|
||||
{
|
||||
const string document = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
|
|
@ -235,7 +241,7 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAcceptsElseIfWithNoCondition()
|
||||
public void AcceptsElseIfWithNoCondition()
|
||||
{
|
||||
// We don't want to be a full C# parser - If the else if is missing it's condition, the C# compiler
|
||||
// can handle that, we have all the info we need to keep parsing
|
||||
|
|
@ -249,46 +255,46 @@ else if(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesDoWhileBlock()
|
||||
public void CorrectlyParsesDoWhileBlock()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"do { var foo = bar; } while(foo != bar);");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesDoWhileBlockMissingSemicolon()
|
||||
public void CorrectlyParsesDoWhileBlockMissingSemicolon()
|
||||
{
|
||||
SingleSpanBlockTest("do { var foo = bar; } while(foo != bar)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesDoWhileBlockMissingWhileCondition()
|
||||
public void CorrectlyParsesDoWhileBlockMissingWhileCondition()
|
||||
{
|
||||
SingleSpanBlockTest("do { var foo = bar; } while");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon()
|
||||
public void CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"do { var foo = bar; } while;");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesDoWhileBlockMissingWhileClauseEntirely()
|
||||
public void CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely()
|
||||
{
|
||||
SingleSpanBlockTest("do { var foo = bar; } narf;");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenDoAndWhileClause()
|
||||
public void SupportsBlockCommentBetweenDoAndWhileClause()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"do { var foo = bar; } /* Foo */ /* Bar */ while(true);");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenDoAndWhileClause()
|
||||
public void SupportsLineCommentBetweenDoAndWhileClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"do { var foo = bar; }
|
||||
// Foo
|
||||
|
|
@ -297,21 +303,22 @@ while(true);");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenDoAndWhileClause()
|
||||
public void SupportsRazorCommentBetweenDoAndWhileClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest(
|
||||
"do { var foo = bar; } ", " while(true);");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesMarkupInDoWhileBlock()
|
||||
public void CorrectlyParsesMarkupInDoWhileBlock()
|
||||
{
|
||||
ParseBlockTest("@do { var foo = bar; <p>Foo</p> foo++; } while (foo<bar>);");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsSwitchKeyword()
|
||||
public void SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsSwitchKeyword
|
||||
SingleSpanBlockTest(@"switch(foo) {
|
||||
case 0:
|
||||
break;
|
||||
|
|
@ -327,119 +334,120 @@ while(true);");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsLockKeyword()
|
||||
public void ThenBalancesBracesIfFirstIdentifierIsLockKeyword()
|
||||
{
|
||||
// ParseBlockSkipsParenthesisedExpressionAndThenBalancesBracesIfFirstIdentifierIsLockKeyword
|
||||
SingleSpanBlockTest(
|
||||
"lock(foo) { Debug.WriteLine(@\"foo } bar\"); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHasErrorsIfNamespaceImportMissingSemicolon()
|
||||
public void HasErrorsIfNamespaceImportMissingSemicolon()
|
||||
{
|
||||
ParseBlockTest(
|
||||
"using Foo.Bar.Baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHasErrorsIfNamespaceAliasMissingSemicolon()
|
||||
public void HasErrorsIfNamespaceAliasMissingSemicolon()
|
||||
{
|
||||
ParseBlockTest(
|
||||
"using Foo.Bar.Baz = FooBarBaz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat()
|
||||
public void ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat()
|
||||
{
|
||||
ParseBlockTest(
|
||||
"using Foo.Bar.Baz;");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockDoesntCaptureWhitespaceAfterUsing()
|
||||
public void DoesntCaptureWhitespaceAfterUsing()
|
||||
{
|
||||
ParseBlockTest("using Foo ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCapturesNewlineAfterUsing()
|
||||
public void CapturesNewlineAfterUsing()
|
||||
{
|
||||
ParseBlockTest($"using Foo{Environment.NewLine}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat()
|
||||
public void ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat()
|
||||
{
|
||||
ParseBlockTest(
|
||||
"using FooBarBaz = FooBarBaz;");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock()
|
||||
public void TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock()
|
||||
{
|
||||
SingleSpanBlockTest("using ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesSingleLineCommentAtEndOfFile()
|
||||
public void TerminatesSingleLineCommentAtEndOfFile()
|
||||
{
|
||||
const string document = "foreach(var f in Foo) { // foo bar baz";
|
||||
SingleSpanBlockTest(document);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesBlockCommentAtEndOfFile()
|
||||
public void TerminatesBlockCommentAtEndOfFile()
|
||||
{
|
||||
const string document = "foreach(var f in Foo) { /* foo bar baz";
|
||||
SingleSpanBlockTest(document);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesSingleSlashAtEndOfFile()
|
||||
public void TerminatesSingleSlashAtEndOfFile()
|
||||
{
|
||||
const string document = "foreach(var f in Foo) { / foo bar baz";
|
||||
SingleSpanBlockTest(document);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenTryAndFinallyClause()
|
||||
public void SupportsBlockCommentBetweenTryAndFinallyClause()
|
||||
{
|
||||
SingleSpanBlockTest("try { bar(); } /* Foo */ /* Bar */ finally { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenTryAndFinallyClause()
|
||||
public void SupportsRazorCommentBetweenTryAndFinallyClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest("try { bar(); } ", " finally { biz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenCatchAndFinallyClause()
|
||||
public void SupportsBlockCommentBetweenCatchAndFinallyClause()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenCatchAndFinallyClause()
|
||||
public void SupportsRazorCommentBetweenCatchAndFinallyClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest(
|
||||
"try { bar(); } catch(bar) { baz(); } ", " finally { biz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsBlockCommentBetweenTryAndCatchClause()
|
||||
public void SupportsBlockCommentBetweenTryAndCatchClause()
|
||||
{
|
||||
SingleSpanBlockTest("try { bar(); } /* Foo */ /* Bar */ catch(bar) { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsRazorCommentBetweenTryAndCatchClause()
|
||||
public void SupportsRazorCommentBetweenTryAndCatchClause()
|
||||
{
|
||||
RunRazorCommentBetweenClausesTest("try { bar(); }", " catch(bar) { baz(); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenTryAndFinallyClause()
|
||||
public void SupportsLineCommentBetweenTryAndFinallyClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"try { bar(); }
|
||||
// Foo
|
||||
|
|
@ -448,7 +456,7 @@ finally { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenCatchAndFinallyClause()
|
||||
public void SupportsLineCommentBetweenCatchAndFinallyClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"try { bar(); } catch(bar) { baz(); }
|
||||
// Foo
|
||||
|
|
@ -457,7 +465,7 @@ finally { biz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenTryAndCatchClause()
|
||||
public void SupportsLineCommentBetweenTryAndCatchClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"try { bar(); }
|
||||
// Foo
|
||||
|
|
@ -466,13 +474,13 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsTryStatementWithNoAdditionalClauses()
|
||||
public void SupportsTryStatementWithNoAdditionalClauses()
|
||||
{
|
||||
SingleSpanBlockTest("try { var foo = new { } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsMarkupWithinTryClause()
|
||||
public void SupportsMarkupWithinTryClause()
|
||||
{
|
||||
RunSimpleWrappedMarkupTest(
|
||||
prefix: "try {",
|
||||
|
|
@ -481,13 +489,13 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsTryStatementWithOneCatchClause()
|
||||
public void SupportsTryStatementWithOneCatchClause()
|
||||
{
|
||||
SingleSpanBlockTest("try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsMarkupWithinCatchClause()
|
||||
public void SupportsMarkupWithinCatchClause()
|
||||
{
|
||||
RunSimpleWrappedMarkupTest(
|
||||
prefix: "try { var foo = new { } } catch(Foo Bar Baz) {",
|
||||
|
|
@ -496,7 +504,7 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsTryStatementWithMultipleCatchClause()
|
||||
public void SupportsTryStatementWithMultipleCatchClause()
|
||||
{
|
||||
SingleSpanBlockTest(
|
||||
"try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) " +
|
||||
|
|
@ -504,13 +512,13 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsExceptionLessCatchClauses()
|
||||
public void SupportsExceptionLessCatchClauses()
|
||||
{
|
||||
SingleSpanBlockTest("try { var foo = new { } } catch { var foo = new { } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsMarkupWithinAdditionalCatchClauses()
|
||||
public void SupportsMarkupWithinAdditionalCatchClauses()
|
||||
{
|
||||
RunSimpleWrappedMarkupTest(
|
||||
prefix: "try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) " +
|
||||
|
|
@ -520,13 +528,13 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsTryStatementWithFinallyClause()
|
||||
public void SupportsTryStatementWithFinallyClause()
|
||||
{
|
||||
SingleSpanBlockTest("try { var foo = new { } } finally { var foo = new { } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsMarkupWithinFinallyClause()
|
||||
public void SupportsMarkupWithinFinallyClause()
|
||||
{
|
||||
RunSimpleWrappedMarkupTest(
|
||||
prefix: "try { var foo = new { } } finally {",
|
||||
|
|
@ -535,57 +543,58 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsParsingCatchClausesAfterFinallyBlock()
|
||||
public void StopsParsingCatchClausesAfterFinallyBlock()
|
||||
{
|
||||
var content = "try { var foo = new { } } finally { var foo = new { } }";
|
||||
SingleSpanBlockTest(content + " catch(Foo Bar Baz) { }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockDoesNotAllowMultipleFinallyBlocks()
|
||||
public void DoesNotAllowMultipleFinallyBlocks()
|
||||
{
|
||||
var content = "try { var foo = new { } } finally { var foo = new { } }";
|
||||
SingleSpanBlockTest(content + " finally { }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode()
|
||||
public void AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest(@"if(foo) { @foo. }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesExpressionOnSwitchCharacterFollowedByOpenParen()
|
||||
public void ParsesExpressionOnSwitchCharacterFollowedByOpenParen()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest(@"if(foo) { @(foo + bar) }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesExpressionOnSwitchCharacterFollowedByIdentifierStart()
|
||||
public void ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest(@"if(foo) { @foo[4].bar() }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart()
|
||||
public void TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest(@"if(foo) { @@class.Foo() }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTreatsAtSignsAfterFirstPairAsPartOfCSharpStatement()
|
||||
public void TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest(@"if(foo) { @@@@class.Foo() }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockDoesNotParseMarkupStatementOrExpressionOnSwitchCharacterNotFollowedByOpenAngleOrColon()
|
||||
public void DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon()
|
||||
{
|
||||
// ParseBlockDoesNotParseMarkupStatementOrExpressionOnSwitchCharacterNotFollowedByOpenAngleOrColon
|
||||
// Arrange
|
||||
ParseBlockTest("if(foo) { @\"Foo\".ToString(); }");
|
||||
}
|
||||
|
|
@ -607,62 +616,62 @@ catch(bar) { baz(); }");
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionInAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionInAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='@@' />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='abc@@' />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='@@def' />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionBetweenAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionBetweenAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='abc @@ def' />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionWithExpressionBlock_DoesNotThrow()
|
||||
public void WithDoubleTransitionWithExpressionBlock_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='@@@(2+3)' bar='@(2+3)@@@DateTime.Now' baz='@DateTime.Now@@' bat='@DateTime.Now @@' zoo='@@@DateTime.Now' />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionInEmail_DoesNotThrow()
|
||||
public void WithDoubleTransitionInEmail_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='abc@def.com abc@@def.com @@' />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransitionInRegex_DoesNotThrow()
|
||||
public void WithDoubleTransitionInRegex_DoesNotThrow()
|
||||
{
|
||||
var input = @"{<span foo=""/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@@[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i"" />}";
|
||||
ParseBlockTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransition_EndOfFile_Throws()
|
||||
public void WithDoubleTransition_EndOfFile_Throws()
|
||||
{
|
||||
ParseBlockTest("{<span foo='@@");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithUnexpectedTransitionsInAttributeValue_Throws()
|
||||
public void WithUnexpectedTransitionsInAttributeValue_Throws()
|
||||
{
|
||||
ParseBlockTest("{<span foo='@ @' />}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,79 +10,83 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpErrorTest : CsHtmlCodeParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockHandlesQuotesAfterTransition()
|
||||
public void HandlesQuotesAfterTransition()
|
||||
{
|
||||
ParseBlockTest("@\"");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockWithHelperDirectiveProducesError()
|
||||
public void WithHelperDirectiveProducesError()
|
||||
{
|
||||
ParseBlockTest("@helper fooHelper { }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockWithNestedCodeBlockProducesError()
|
||||
public void WithNestedCodeBlockProducesError()
|
||||
{
|
||||
ParseBlockTest("@if { @{} }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCapturesWhitespaceToEndOfLineInInvalidUsingStatementAndTreatsAsFileCode()
|
||||
public void CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode()
|
||||
{
|
||||
// ParseBlockCapturesWhitespaceToEndOfLineInInvalidUsingStatementAndTreatsAsFileCode
|
||||
ParseBlockTest("using " + Environment.NewLine
|
||||
+ Environment.NewLine);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace()
|
||||
public void MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace()
|
||||
{
|
||||
ParseBlockTest("{");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty()
|
||||
public void MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty()
|
||||
{
|
||||
ParseBlockTest("{}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodProducesErrorIfNewlineFollowsTransition()
|
||||
public void MethodProducesErrorIfNewlineFollowsTransition()
|
||||
{
|
||||
ParseBlockTest("@" + Environment.NewLine);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpression()
|
||||
public void MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr()
|
||||
{
|
||||
// ParseBlockMethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpression
|
||||
ParseBlockTest("{" + Environment.NewLine
|
||||
+ " @ {}" + Environment.NewLine
|
||||
+ "}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression()
|
||||
public void MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression()
|
||||
{
|
||||
ParseBlockTest("{" + Environment.NewLine
|
||||
+ " @");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace()
|
||||
public void MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace()
|
||||
{
|
||||
ParseBlockTest("@!!!");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExpressionUnclosed()
|
||||
public void ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed()
|
||||
{
|
||||
// ParseBlockShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExpressionUnclosed
|
||||
ParseBlockTest("(foo bar" + Environment.NewLine
|
||||
+ "baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExpressionUnclosed()
|
||||
public void ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed()
|
||||
{
|
||||
// ParseBlockShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExpressionUnclosed
|
||||
ParseBlockTest("(foo bar" + Environment.NewLine
|
||||
+ "<html>" + Environment.NewLine
|
||||
+ "baz" + Environment.NewLine
|
||||
|
|
@ -90,7 +94,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed()
|
||||
public void CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed()
|
||||
{
|
||||
ParseBlockTest("Href(" + Environment.NewLine
|
||||
+ "<h1>@Html.Foo(Bar);</h1>" + Environment.NewLine);
|
||||
|
|
@ -98,8 +102,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
[Fact]
|
||||
// Test for fix to Dev10 884975 - Incorrect Error Messaging
|
||||
public void ParseBlockShouldReportErrorAndTerminateAtEOFIfParenInImplicitExpressionUnclosed()
|
||||
public void ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed()
|
||||
{
|
||||
// ParseBlockShouldReportErrorAndTerminateAtEOFIfParenInImplicitExpressionUnclosed
|
||||
ParseBlockTest("Foo(Bar(Baz)" + Environment.NewLine
|
||||
+ "Biz" + Environment.NewLine
|
||||
+ "Boz");
|
||||
|
|
@ -107,8 +112,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
[Fact]
|
||||
// Test for fix to Dev10 884975 - Incorrect Error Messaging
|
||||
public void ParseBlockShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed()
|
||||
public void ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed()
|
||||
{
|
||||
// ParseBlockShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed
|
||||
ParseBlockTest("Foo(Bar(Baz)" + Environment.NewLine
|
||||
+ "Biz" + Environment.NewLine
|
||||
+ "<html>" + Environment.NewLine
|
||||
|
|
@ -118,8 +124,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
[Fact]
|
||||
// Test for fix to Dev10 884975 - Incorrect Error Messaging
|
||||
public void ParseBlockShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed()
|
||||
public void ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed()
|
||||
{
|
||||
// ParseBlockShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed
|
||||
ParseBlockTest("Foo[Bar[Baz]" + Environment.NewLine
|
||||
+ "Biz" + Environment.NewLine
|
||||
+ "Boz");
|
||||
|
|
@ -127,8 +134,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
[Fact]
|
||||
// Test for fix to Dev10 884975 - Incorrect Error Messaging
|
||||
public void ParseBlockShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExpressionUnclosed()
|
||||
public void ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed()
|
||||
{
|
||||
// ParseBlockShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExpressionUnclosed
|
||||
ParseBlockTest("Foo[Bar[Baz]" + Environment.NewLine
|
||||
+ "Biz" + Environment.NewLine
|
||||
+ "<b>" + Environment.NewLine
|
||||
|
|
@ -138,13 +146,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
// Simple EOF handling errors:
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfExplicitCodeBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("{ var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfClassBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfClassBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest(
|
||||
"functions { var foo = bar; if(foo != null) { bar(); } ",
|
||||
|
|
@ -152,138 +160,138 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfIfBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfIfBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("if");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfElseBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfElseBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfElseIfBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfElseIfBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfDoBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfDoBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("do { var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfTryBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfTryBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("try { var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfCatchBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfCatchBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfFinallyBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfFinallyBlockUnterminatedAtEOF()
|
||||
{
|
||||
ParseBlockTest("try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfForBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfForBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("for");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfForeachBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfForeachBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("foreach");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfWhileBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfWhileBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("while");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfSwitchBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfSwitchBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("switch");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfLockBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfLockBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("lock");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReportsErrorIfUsingBlockUnterminatedAtEOF()
|
||||
public void ReportsErrorIfUsingBlockUnterminatedAtEOF()
|
||||
{
|
||||
RunUnterminatedSimpleKeywordBlock("using");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockRequiresControlFlowStatementsToHaveBraces()
|
||||
public void RequiresControlFlowStatementsToHaveBraces()
|
||||
{
|
||||
ParseBlockTest("if(foo) <p>Bar</p> else if(bar) <p>Baz</p> else <p>Boz</p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockIncludesUnexpectedCharacterInSingleStatementControlFlowStatementError()
|
||||
public void IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError()
|
||||
{
|
||||
ParseBlockTest("if(foo)) { var bar = foo; }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockOutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart()
|
||||
public void OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart()
|
||||
{
|
||||
ParseBlockTest("if(foo) { @<p>Bar</p> }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
public void TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
{
|
||||
ParseBlockTest("if(foo bar" + Environment.NewLine
|
||||
+ "baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
public void TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
{
|
||||
ParseBlockTest("foreach(foo bar" + Environment.NewLine
|
||||
+ "baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesWhileClauseInDoStatementAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
public void TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
{
|
||||
ParseBlockTest("do { } while(foo bar" + Environment.NewLine
|
||||
+ "baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
public void TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen()
|
||||
{
|
||||
ParseBlockTest("using(foo bar" + Environment.NewLine
|
||||
+ "baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockResumesIfStatementAfterOpenParen()
|
||||
public void ResumesIfStatementAfterOpenParen()
|
||||
{
|
||||
ParseBlockTest("if(" + Environment.NewLine
|
||||
+ "else { <p>Foo</p> }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing()
|
||||
public void TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing()
|
||||
{
|
||||
SingleSpanBlockTest("if(foo) {" + Environment.NewLine
|
||||
+ " var p = \"foo bar baz" + Environment.NewLine
|
||||
|
|
@ -292,13 +300,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesNormalStringAtEndOfFile()
|
||||
public void TerminatesNormalStringAtEndOfFile()
|
||||
{
|
||||
SingleSpanBlockTest("if(foo) { var foo = \"blah blah blah blah blah");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesVerbatimStringAtEndOfFile()
|
||||
public void TerminatesVerbatimStringAtEndOfFile()
|
||||
{
|
||||
SingleSpanBlockTest("if(foo) { var foo = @\"blah " + Environment.NewLine
|
||||
+ "blah; " + Environment.NewLine
|
||||
|
|
@ -308,7 +316,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement()
|
||||
public void CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement()
|
||||
{
|
||||
ParseBlockTest("if(foo) {" + Environment.NewLine
|
||||
+ " var foo = \"foo bar baz" + Environment.NewLine
|
||||
|
|
@ -317,13 +325,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyParsesAtSignInDelimitedBlock()
|
||||
public void CorrectlyParsesAtSignInDelimitedBlock()
|
||||
{
|
||||
ParseBlockTest("(Request[\"description\"] ?? @photo.Description)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyRecoversFromMissingCloseParenInExpressionWithinCode()
|
||||
public void CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode()
|
||||
{
|
||||
ParseBlockTest(@"{string.Format(<html></html>}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,37 +9,38 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpExplicitExpressionTest : CsHtmlCodeParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty()
|
||||
public void ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty()
|
||||
{
|
||||
ParseBlockTest("@()");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpression()
|
||||
public void ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr()
|
||||
{
|
||||
// ParseBlockShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpression
|
||||
ParseBlockTest("@(");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptEscapedQuoteInNonVerbatimStrings()
|
||||
public void ShouldAcceptEscapedQuoteInNonVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(\"\\\"\")");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptEscapedQuoteInVerbatimStrings()
|
||||
public void ShouldAcceptEscapedQuoteInVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(@\"\"\"\")");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings()
|
||||
public void ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(@\"\"\"\"\"\")");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptMultiLineVerbatimStrings()
|
||||
public void ShouldAcceptMultiLineVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest(@"@(@""" + Environment.NewLine
|
||||
+ @"Foo" + Environment.NewLine
|
||||
|
|
@ -49,25 +50,25 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings()
|
||||
public void ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(\"\\\"hello, world\\\"\")");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptMultipleEscapedQuotesInVerbatimStrings()
|
||||
public void ShouldAcceptMultipleEscapedQuotesInVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(@\"\"\"hello, world\"\"\")");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings()
|
||||
public void ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(\"\\\"\\\"\")");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings()
|
||||
public void ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings()
|
||||
{
|
||||
ParseBlockTest("@(@\"\"\"\"\"\")");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,210 +8,210 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpImplicitExpressionTest : CsHtmlCodeParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket1()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket1()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??[");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket2()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket2()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??[0");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket3()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket3()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket4()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket4()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?(");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket5()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket5()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[more");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket6()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket6()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[0]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket7()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket7()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket8()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket8()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[more.<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket9()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket9()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??[more<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket10()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket10()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[-1]?");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket11()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket11()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[abc]?[def");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket12()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket12()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[abc]?[2]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket13()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket13()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[abc]?.more?[def]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket14()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket14()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[abc]?.more?.abc");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket15()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket15()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[null ?? true]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Bracket16()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Bracket16()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?[abc?.gef?[-1]]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot1()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot1()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot2()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot2()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot3()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot3()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??more");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot4()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot4()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?!");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot5()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot5()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot6()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot6()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot7()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot7()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.(abc)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot8()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot8()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot9()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot9()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.more");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot10()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot10()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.more<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot11()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot11()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val??.more<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot12()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot12()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.more(false)?.<p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot13()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot13()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.more(false)?.abc");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesNullConditionalOperatorImplicitExpression_Dot14()
|
||||
public void ParsesNullConditionalOperatorImplicitExpression_Dot14()
|
||||
{
|
||||
// Act & Assert
|
||||
ImplicitExpressionTest("val?.more(null ?? true)?.abc");
|
||||
|
|
@ -224,145 +224,149 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAcceptsNonEnglishCharactersThatAreValidIdentifiers()
|
||||
public void AcceptsNonEnglishCharactersThatAreValidIdentifiers()
|
||||
{
|
||||
ImplicitExpressionTest("हळूँजद॔.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockOutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition()
|
||||
public void OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition()
|
||||
{
|
||||
ParseBlockTest("@/");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockOutputsZeroLengthCodeSpanIfEOFOccursAfterTransition()
|
||||
public void OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition()
|
||||
{
|
||||
ParseBlockTest("@");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsSlashesWithinComplexImplicitExpressions()
|
||||
public void SupportsSlashesWithinComplexImplicitExpressions()
|
||||
{
|
||||
ImplicitExpressionTest("DataGridColumn.Template(\"Years of Service\", e => (int)Math.Round((DateTime.Now - dt).TotalDays / 365))");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesSingleIdentifierAsImplicitExpression()
|
||||
public void ParsesSingleIdentifierAsImplicitExpression()
|
||||
{
|
||||
ImplicitExpressionTest("foo");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodDoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace()
|
||||
public void DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace()
|
||||
{
|
||||
ImplicitExpressionTest("foo ;");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodIgnoresSemicolonAtEndOfSimpleImplicitExpression()
|
||||
public void IgnoresSemicolonAtEndOfSimpleImplicitExpression()
|
||||
{
|
||||
RunTrailingSemicolonTest("foo");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodParsesDottedIdentifiersAsImplicitExpression()
|
||||
public void ParsesDottedIdentifiersAsImplicitExpression()
|
||||
{
|
||||
ImplicitExpressionTest("foo.bar.baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodIgnoresSemicolonAtEndOfDottedIdentifiers()
|
||||
public void IgnoresSemicolonAtEndOfDottedIdentifiers()
|
||||
{
|
||||
RunTrailingSemicolonTest("foo.bar.baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodDoesNotIncludeDotAtEOFInImplicitExpression()
|
||||
public void DoesNotIncludeDotAtEOFInImplicitExpression()
|
||||
{
|
||||
ImplicitExpressionTest("foo.bar.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodDoesNotIncludeDotFollowedByInvalidIdentifierCharacterInImplicitExpression1()
|
||||
public void DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1()
|
||||
{
|
||||
// ParseBlockMethodDoesNotIncludeDotFollowedByInvalidIdentifierCharacterInImplicitExpression1
|
||||
ImplicitExpressionTest("foo.bar.0");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodDoesNotIncludeDotFollowedByInvalidIdentifierCharacterInImplicitExpression2()
|
||||
public void DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2()
|
||||
{
|
||||
// ParseBlockMethodDoesNotIncludeDotFollowedByInvalidIdentifierCharacterInImplicitExpression2
|
||||
ImplicitExpressionTest("foo.bar.</p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodDoesNotIncludeSemicolonAfterDot()
|
||||
public void DoesNotIncludeSemicolonAfterDot()
|
||||
{
|
||||
ImplicitExpressionTest("foo.bar.;");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockMethodTerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpression()
|
||||
public void TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr()
|
||||
{
|
||||
// ParseBlockMethodTerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpression
|
||||
ImplicitExpressionTest("foo.bar</p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockProperlyParsesParenthesesAndBalancesThemInImplicitExpression()
|
||||
public void ProperlyParsesParenthesesAndBalancesThemInImplicitExpression()
|
||||
{
|
||||
ImplicitExpressionTest(@"foo().bar(""bi\""z"", 4)(""chained method; call"").baz(@""bo""""z"", '\'', () => { return 4; }, (4+5+new { foo = bar[4] }))");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockProperlyParsesBracketsAndBalancesThemInImplicitExpression()
|
||||
public void ProperlyParsesBracketsAndBalancesThemInImplicitExpression()
|
||||
{
|
||||
ImplicitExpressionTest(@"foo.bar[4 * (8 + 7)][""fo\""o""].baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesImplicitExpressionAtHtmlEndTag()
|
||||
public void TerminatesImplicitExpressionAtHtmlEndTag()
|
||||
{
|
||||
ImplicitExpressionTest("foo().bar.baz</p>zoop");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesImplicitExpressionAtHtmlStartTag()
|
||||
public void TerminatesImplicitExpressionAtHtmlStartTag()
|
||||
{
|
||||
ImplicitExpressionTest("foo().bar.baz<p>zoop");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesImplicitExpressionBeforeDotIfDotNotFollowedByIdentifierStartCharacter()
|
||||
public void TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar()
|
||||
{
|
||||
// ParseBlockTerminatesImplicitExpressionBeforeDotIfDotNotFollowedByIdentifierStartCharacter
|
||||
ImplicitExpressionTest("foo().bar.baz.42");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsBalancingParenthesesAtEOF()
|
||||
public void StopsBalancingParenthesesAtEOF()
|
||||
{
|
||||
ImplicitExpressionTest("foo(()");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace()
|
||||
public void TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace()
|
||||
{
|
||||
ImplicitExpressionTest("foo.bar() (baz)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace()
|
||||
public void TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace()
|
||||
{
|
||||
ImplicitExpressionTest("foo .bar() (baz)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace()
|
||||
public void TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace()
|
||||
{
|
||||
ImplicitExpressionTest("foo. bar() (baz)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockOutputExpressionIfModuleTokenNotFollowedByBrace()
|
||||
public void OutputExpressionIfModuleTokenNotFollowedByBrace()
|
||||
{
|
||||
ImplicitExpressionTest("module.foo()");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpSectionTest : CsHtmlMarkupParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseSectionBlockCapturesNewlineImmediatelyFollowing()
|
||||
public void CapturesNewlineImmediatelyFollowing()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section" + Environment.NewLine,
|
||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockCapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace()
|
||||
public void CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section Foo " + Environment.NewLine + " ",
|
||||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockCapturesWhitespaceToEndOfLineInSectionStatementMissingName()
|
||||
public void CapturesWhitespaceToEndOfLineInSectionStatementMissingName()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section " + Environment.NewLine + " ",
|
||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockIgnoresSectionUnlessAllLowerCase()
|
||||
public void IgnoresSectionUnlessAllLowerCase()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@Section foo",
|
||||
|
|
@ -42,16 +42,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartCharacter()
|
||||
public void ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar()
|
||||
{
|
||||
// ParseSectionBlockReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartCharacter
|
||||
ParseDocumentTest(
|
||||
"@section 9 { <p>Foo</p> }",
|
||||
new[] { SectionDirective.Directive });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace()
|
||||
public void ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace()
|
||||
{
|
||||
// ParseSectionBlockReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace
|
||||
ParseDocumentTest(
|
||||
"@section foo-bar { <p>Foo</p> }",
|
||||
new[] { SectionDirective.Directive });
|
||||
|
|
@ -66,7 +68,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesEOFAfterOpenBrace()
|
||||
public void HandlesEOFAfterOpenBrace()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo {",
|
||||
|
|
@ -74,7 +76,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesEOFAfterOpenContent1()
|
||||
public void HandlesEOFAfterOpenContent1()
|
||||
{
|
||||
|
||||
ParseDocumentTest(
|
||||
|
|
@ -83,7 +85,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesEOFAfterOpenContent2()
|
||||
public void HandlesEOFAfterOpenContent2()
|
||||
{
|
||||
|
||||
ParseDocumentTest(
|
||||
|
|
@ -92,7 +94,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesEOFAfterOpenContent3()
|
||||
public void HandlesEOFAfterOpenContent3()
|
||||
{
|
||||
|
||||
ParseDocumentTest(
|
||||
|
|
@ -101,7 +103,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesEOFAfterOpenContent4()
|
||||
public void HandlesEOFAfterOpenContent4()
|
||||
{
|
||||
|
||||
ParseDocumentTest(
|
||||
|
|
@ -110,7 +112,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesUnterminatedSection()
|
||||
public void HandlesUnterminatedSection()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo { <p>Foo{}</p>",
|
||||
|
|
@ -118,7 +120,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockHandlesUnterminatedSectionWithNestedIf()
|
||||
public void HandlesUnterminatedSectionWithNestedIf()
|
||||
{
|
||||
// Arrange
|
||||
var newLine = Environment.NewLine;
|
||||
|
|
@ -134,8 +136,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockReportsErrorAndAcceptsWhitespaceToEndOfLineIfSectionNotFollowedByOpenBrace()
|
||||
public void ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace()
|
||||
{
|
||||
// ParseSectionBlockReportsErrorAndAcceptsWhitespaceToEndOfLineIfSectionNotFollowedByOpenBrace
|
||||
// Arrange
|
||||
var chunkGenerator = new DirectiveChunkGenerator(SectionDirective.Directive);
|
||||
chunkGenerator.Diagnostics.Add(
|
||||
|
|
@ -151,7 +154,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockAcceptsOpenBraceMultipleLinesBelowSectionName()
|
||||
public void AcceptsOpenBraceMultipleLinesBelowSectionName()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo "
|
||||
|
|
@ -168,7 +171,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockParsesNamedSectionCorrectly()
|
||||
public void ParsesNamedSectionCorrectly()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo { <p>Foo</p> }",
|
||||
|
|
@ -176,7 +179,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockDoesNotRequireSpaceBetweenSectionNameAndOpenBrace()
|
||||
public void DoesNotRequireSpaceBetweenSectionNameAndOpenBrace()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo{ <p>Foo</p> }",
|
||||
|
|
@ -184,7 +187,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockBalancesBraces()
|
||||
public void BalancesBraces()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo { <script>(function foo() { return 1; })();</script> }",
|
||||
|
|
@ -192,7 +195,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockAllowsBracesInCSharpExpression()
|
||||
public void AllowsBracesInCSharpExpression()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo { I really want to render a close brace, so here I go: @(\"}\") }",
|
||||
|
|
@ -211,8 +214,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlockNoWhitespace()
|
||||
public void SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace()
|
||||
{
|
||||
// SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlockNoWhitespace
|
||||
ParseDocumentTest(
|
||||
"@section Foo {" + Environment.NewLine
|
||||
+ "@if(true) {" + Environment.NewLine
|
||||
|
|
@ -221,7 +225,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockCorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup()
|
||||
public void CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section foo {something}",
|
||||
|
|
@ -229,7 +233,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockParsesComment()
|
||||
public void ParsesComment()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section s {<!-- -->}",
|
||||
|
|
@ -239,7 +243,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
// This was a user reported bug (codeplex #710), the section parser wasn't handling
|
||||
// comments.
|
||||
[Fact]
|
||||
public void ParseSectionBlockParsesCommentWithDelimiters()
|
||||
public void ParsesCommentWithDelimiters()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section s {<!-- > \" '-->}",
|
||||
|
|
@ -247,7 +251,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockCommentRecoversFromUnclosedTag()
|
||||
public void CommentRecoversFromUnclosedTag()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section s {" + Environment.NewLine + "<a" + Environment.NewLine + "<!-- > \" '-->}",
|
||||
|
|
@ -255,7 +259,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlockParsesXmlProcessingInstruction()
|
||||
public void ParsesXmlProcessingInstruction()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
"@section s { <? xml bleh ?>}",
|
||||
|
|
@ -263,13 +267,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlock_WithDoubleTransition1()
|
||||
public void _WithDoubleTransition1()
|
||||
{
|
||||
ParseDocumentTest("@section s {<span foo='@@' />}", new[] { SectionDirective.Directive });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseSectionBlock_WithDoubleTransition2()
|
||||
public void _WithDoubleTransition2()
|
||||
{
|
||||
ParseDocumentTest("@section s {<span foo='@DateTime.Now @@' />}", new[] { SectionDirective.Directive });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,14 +30,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockBalancesBracesOutsideStringsIfFirstCharacterIsBraceAndReturnsSpanOfTypeCode()
|
||||
public void BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode()
|
||||
{
|
||||
// ParseBlockBalancesBracesOutsideStringsIfFirstCharacterIsBraceAndReturnsSpanOfTypeCode
|
||||
ParseBlockTest("{foo\"b}ar\" if(condition) { string.Format(\"{0}\"); } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockBalancesParensOutsideStringsIfFirstCharacterIsParenAndReturnsSpanOfTypeExpression()
|
||||
public void BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr()
|
||||
{
|
||||
// ParseBlockBalancesParensOutsideStringsIfFirstCharacterIsParenAndReturnsSpanOfTypeExpression
|
||||
ParseBlockTest("(foo\"b)ar\" if(condition) { string.Format(\"{0}\"); } )");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,79 +9,82 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpTemplateTest : CsHtmlCodeParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockHandlesSingleLineTemplate()
|
||||
public void HandlesSingleLineTemplate()
|
||||
{
|
||||
ParseBlockTest("{ var foo = @: bar" + Environment.NewLine + "; }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesSingleLineImmediatelyFollowingStatementChar()
|
||||
public void HandlesSingleLineImmediatelyFollowingStatementChar()
|
||||
{
|
||||
ParseBlockTest("{i@: bar" + Environment.NewLine + "}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesSimpleTemplateInExplicitExpressionParens()
|
||||
public void HandlesSimpleTemplateInExplicitExpressionParens()
|
||||
{
|
||||
ParseBlockTest("(Html.Repeat(10, @<p>Foo #@item</p>))");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesSimpleTemplateInImplicitExpressionParens()
|
||||
public void HandlesSimpleTemplateInImplicitExpressionParens()
|
||||
{
|
||||
ParseBlockTest("Html.Repeat(10, @<p>Foo #@item</p>)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesTwoTemplatesInImplicitExpressionParens()
|
||||
public void HandlesTwoTemplatesInImplicitExpressionParens()
|
||||
{
|
||||
ParseBlockTest("Html.Repeat(10, @<p>Foo #@item</p>, @<p>Foo #@item</p>)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockProducesErrorButCorrectlyParsesNestedTemplateInImplicitExpressionParens()
|
||||
public void ProducesErrorButCorrectlyParsesNestedTemplateInImplicitExprParens()
|
||||
{
|
||||
// ParseBlockProducesErrorButCorrectlyParsesNestedTemplateInImplicitExpressionParens
|
||||
ParseBlockTest("Html.Repeat(10, @<p>Foo #@Html.Repeat(10, @<p>@item</p>)</p>)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesSimpleTemplateInStatementWithinCodeBlock()
|
||||
public void HandlesSimpleTemplateInStatementWithinCodeBlock()
|
||||
{
|
||||
ParseBlockTest("foreach(foo in Bar) { Html.ExecuteTemplate(foo, @<p>Foo #@item</p>); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesTwoTemplatesInStatementWithinCodeBlock()
|
||||
public void HandlesTwoTemplatesInStatementWithinCodeBlock()
|
||||
{
|
||||
ParseBlockTest("foreach(foo in Bar) { Html.ExecuteTemplate(foo, @<p>Foo #@item</p>, @<p>Foo #@item</p>); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockProducesErrorButCorrectlyParsesNestedTemplateInStatementWithinCodeBlock()
|
||||
public void ProducesErrorButCorrectlyParsesNestedTemplateInStmtWithinCodeBlock()
|
||||
{
|
||||
// ParseBlockProducesErrorButCorrectlyParsesNestedTemplateInStatementWithinCodeBlock
|
||||
ParseBlockTest("foreach(foo in Bar) { Html.ExecuteTemplate(foo, @<p>Foo #@Html.Repeat(10, @<p>@item</p>)</p>); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesSimpleTemplateInStatementWithinStatementBlock()
|
||||
public void HandlesSimpleTemplateInStatementWithinStatementBlock()
|
||||
{
|
||||
ParseBlockTest("{ var foo = bar; Html.ExecuteTemplate(foo, @<p>Foo #@item</p>); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlessTwoTemplatesInStatementWithinStatementBlock()
|
||||
public void HandlessTwoTemplatesInStatementWithinStatementBlock()
|
||||
{
|
||||
ParseBlockTest("{ var foo = bar; Html.ExecuteTemplate(foo, @<p>Foo #@item</p>, @<p>Foo #@item</p>); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockProducesErrorButCorrectlyParsesNestedTemplateInStatementWithinStatementBlock()
|
||||
public void ProducesErrorButCorrectlyParsesNestedTemplateInStmtWithinStmtBlock()
|
||||
{
|
||||
// ParseBlockProducesErrorButCorrectlyParsesNestedTemplateInStatementWithinStatementBlock
|
||||
ParseBlockTest("{ var foo = bar; Html.ExecuteTemplate(foo, @<p>Foo #@Html.Repeat(10, @<p>@item</p>)</p>); }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlock_WithDoubleTransition_DoesNotThrow()
|
||||
public void _WithDoubleTransition_DoesNotThrow()
|
||||
{
|
||||
ParseBlockTest("{ var foo = bar; Html.ExecuteTemplate(foo, @<p foo='@@'>Foo #@item</p>); }");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesSpacesToCodeOnAtTagTemplateTransitionInDesignTimeMode()
|
||||
public void GivesSpacesToCodeOnAtTagTemplateTransitionInDesignTimeMode()
|
||||
{
|
||||
ParseBlockTest("Foo( @<p>Foo</p> )", designTime: true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesSpacesToCodeOnAtColonTemplateTransitionInDesignTimeMode()
|
||||
public void GivesSpacesToCodeOnAtColonTemplateTransitionInDesignTimeMode()
|
||||
{
|
||||
ParseBlockTest("Foo( " + Environment.NewLine
|
||||
+ "@:<p>Foo</p> " + Environment.NewLine
|
||||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesSpacesToCodeOnTagTransitionInDesignTimeMode()
|
||||
public void GivesSpacesToCodeOnTagTransitionInDesignTimeMode()
|
||||
{
|
||||
ParseBlockTest("{" + Environment.NewLine
|
||||
+ " <p>Foo</p> " + Environment.NewLine
|
||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesSpacesToCodeOnInvalidAtTagTransitionInDesignTimeMode()
|
||||
public void GivesSpacesToCodeOnInvalidAtTagTransitionInDesignTimeMode()
|
||||
{
|
||||
ParseBlockTest("{" + Environment.NewLine
|
||||
+ " @<p>Foo</p> " + Environment.NewLine
|
||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesSpacesToCodeOnAtColonTransitionInDesignTimeMode()
|
||||
public void GivesSpacesToCodeOnAtColonTransitionInDesignTimeMode()
|
||||
{
|
||||
ParseBlockTest("{" + Environment.NewLine
|
||||
+ " @:<p>Foo</p> " + Environment.NewLine
|
||||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldSupportSingleLineMarkupContainingStatementBlock()
|
||||
public void ShouldSupportSingleLineMarkupContainingStatementBlock()
|
||||
{
|
||||
ParseBlockTest("Repeat(10," + Environment.NewLine
|
||||
+ " @: @{}" + Environment.NewLine
|
||||
|
|
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockShouldSupportMarkupWithoutPreceedingWhitespace()
|
||||
public void ShouldSupportMarkupWithoutPreceedingWhitespace()
|
||||
{
|
||||
ParseBlockTest("foreach(var file in files){" + Environment.NewLine
|
||||
+ Environment.NewLine
|
||||
|
|
@ -74,8 +74,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesAllWhitespaceOnSameLineExcludingPreceedingNewlineButIncludingTrailingNewLineToMarkup()
|
||||
public void GivesAllWhitespaceOnSameLineWithTrailingNewLineToMarkupExclPreceedingNewline()
|
||||
{
|
||||
// ParseBlockGivesAllWhitespaceOnSameLineExcludingPreceedingNewlineButIncludingTrailingNewLineToMarkup
|
||||
ParseBlockTest("if(foo) {" + Environment.NewLine
|
||||
+ " var foo = \"After this statement there are 10 spaces\"; " + Environment.NewLine
|
||||
+ " <p>" + Environment.NewLine
|
||||
|
|
@ -88,19 +89,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsMarkupInIfBodyWithBraces()
|
||||
public void AllowsMarkupInIfBodyWithBraces()
|
||||
{
|
||||
ParseBlockTest("if(foo) { <p>Bar</p> } else if(bar) { <p>Baz</p> } else { <p>Boz</p> }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsMarkupInIfBodyWithBracesWithinCodeBlock()
|
||||
public void AllowsMarkupInIfBodyWithBracesWithinCodeBlock()
|
||||
{
|
||||
ParseBlockTest("{ if(foo) { <p>Bar</p> } else if(bar) { <p>Baz</p> } else { <p>Boz</p> } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsMarkupInCaseAndDefaultBranchesOfSwitch()
|
||||
public void SupportsMarkupInCaseAndDefaultBranchesOfSwitch()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest("switch(foo) {" + Environment.NewLine
|
||||
|
|
@ -121,7 +122,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsMarkupInCaseAndDefaultBranchesOfSwitchInCodeBlock()
|
||||
public void SupportsMarkupInCaseAndDefaultBranchesOfSwitchInCodeBlock()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest("{ switch(foo) {" + Environment.NewLine
|
||||
|
|
@ -142,19 +143,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMarkupStatementOnOpenAngleBracket()
|
||||
public void ParsesMarkupStatementOnOpenAngleBracket()
|
||||
{
|
||||
ParseBlockTest("for(int i = 0; i < 10; i++) { <p>Foo</p> }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMarkupStatementOnOpenAngleBracketInCodeBlock()
|
||||
public void ParsesMarkupStatementOnOpenAngleBracketInCodeBlock()
|
||||
{
|
||||
ParseBlockTest("{ for(int i = 0; i < 10; i++) { <p>Foo</p> } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMarkupStatementOnSwitchCharacterFollowedByColon()
|
||||
public void ParsesMarkupStatementOnSwitchCharacterFollowedByColon()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest("if(foo) { @:Bar" + Environment.NewLine
|
||||
|
|
@ -162,7 +163,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMarkupStatementOnSwitchCharacterFollowedByDoubleColon()
|
||||
public void ParsesMarkupStatementOnSwitchCharacterFollowedByDoubleColon()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest("if(foo) { @::Sometext" + Environment.NewLine
|
||||
|
|
@ -171,7 +172,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMarkupStatementOnSwitchCharacterFollowedByTripleColon()
|
||||
public void ParsesMarkupStatementOnSwitchCharacterFollowedByTripleColon()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest("if(foo) { @:::Sometext" + Environment.NewLine
|
||||
|
|
@ -179,7 +180,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesMarkupStatementOnSwitchCharacterFollowedByColonInCodeBlock()
|
||||
public void ParsesMarkupStatementOnSwitchCharacterFollowedByColonInCodeBlock()
|
||||
{
|
||||
// Arrange
|
||||
ParseBlockTest("{ if(foo) { @:Bar" + Environment.NewLine
|
||||
|
|
@ -187,19 +188,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyReturnsFromMarkupBlockWithPseudoTag()
|
||||
public void CorrectlyReturnsFromMarkupBlockWithPseudoTag()
|
||||
{
|
||||
ParseBlockTest("if (i > 0) { <text>;</text> }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyReturnsFromMarkupBlockWithPseudoTagInCodeBlock()
|
||||
public void CorrectlyReturnsFromMarkupBlockWithPseudoTagInCodeBlock()
|
||||
{
|
||||
ParseBlockTest("{ if (i > 0) { <text>;</text> } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsAllKindsOfImplicitMarkupInCodeBlock()
|
||||
public void SupportsAllKindsOfImplicitMarkupInCodeBlock()
|
||||
{
|
||||
ParseBlockTest("{" + Environment.NewLine
|
||||
+ " if(true) {" + Environment.NewLine
|
||||
|
|
|
|||
|
|
@ -17,31 +17,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void InnerImplicitExpressionWithOnlySingleAtOutputsZeroLengthCodeSpan()
|
||||
public void InnerImplicitExprWithOnlySingleAtOutputsZeroLengthCodeSpan()
|
||||
{
|
||||
ParseBlockTest("{@}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InnerImplicitExpressionDoesNotAcceptDotAfterAt()
|
||||
public void InnerImplicitExprDoesNotAcceptDotAfterAt()
|
||||
{
|
||||
ParseBlockTest("{@.}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InnerImplicitExpressionWithOnlySingleAtAcceptsSingleSpaceOrNewlineAtDesignTime()
|
||||
public void InnerImplicitExprWithOnlySingleAtAcceptsSingleSpaceOrNewlineAtDesignTime()
|
||||
{
|
||||
ParseBlockTest("{" + Environment.NewLine + " @" + Environment.NewLine + "}", designTime: true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InnerImplicitExpressionDoesNotAcceptTrailingNewlineInRunTimeMode()
|
||||
public void InnerImplicitExprDoesNotAcceptTrailingNewlineInRunTimeMode()
|
||||
{
|
||||
ParseBlockTest("{@foo." + Environment.NewLine + "}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InnerImplicitExpressionAcceptsTrailingNewlineInDesignTimeMode()
|
||||
public void InnerImplicitExprAcceptsTrailingNewlineInDesignTimeMode()
|
||||
{
|
||||
ParseBlockTest("{@foo." + Environment.NewLine + "}", designTime: true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class CSharpWhitespaceHandlingTest : CsHtmlMarkupParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void StatementBlockDoesNotAcceptTrailingNewlineIfNewlinesAreSignificantToAncestor()
|
||||
public void StmtBlockDoesNotAcceptTrailingNewlineIfTheyAreSignificantToAncestor()
|
||||
{
|
||||
ParseBlockTest("@: @if (true) { }" + Environment.NewLine + "}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class HtmlBlockTest : CsHtmlMarkupParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockHandlesUnbalancedTripleDashHTMLComments()
|
||||
public void HandlesUnbalancedTripleDashHTMLComments()
|
||||
{
|
||||
ParseDocumentTest(
|
||||
@"@{
|
||||
|
|
@ -18,14 +18,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesOpenAngleAtEof()
|
||||
public void HandlesOpenAngleAtEof()
|
||||
{
|
||||
ParseDocumentTest("@{" + Environment.NewLine
|
||||
+ "<");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockHandlesOpenAngleWithProperTagFollowingIt()
|
||||
public void HandlesOpenAngleWithProperTagFollowingIt()
|
||||
{
|
||||
ParseDocumentTest("@{" + Environment.NewLine
|
||||
+ "<" + Environment.NewLine
|
||||
|
|
@ -41,104 +41,104 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsStartAndEndTagsToDifferInCase()
|
||||
public void AllowsStartAndEndTagsToDifferInCase()
|
||||
{
|
||||
ParseBlockTest("<li><p>Foo</P></lI>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockReadsToEndOfLineIfFirstCharacterAfterTransitionIsColon()
|
||||
public void ReadsToEndOfLineIfFirstCharacterAfterTransitionIsColon()
|
||||
{
|
||||
ParseBlockTest("@:<li>Foo Bar Baz" + Environment.NewLine
|
||||
+ "bork");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsParsingSingleLineBlockAtEOFIfNoEOLReached()
|
||||
public void StopsParsingSingleLineBlockAtEOFIfNoEOLReached()
|
||||
{
|
||||
ParseBlockTest("@:foo bar");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsAtMatchingCloseTagToStartTag()
|
||||
public void StopsAtMatchingCloseTagToStartTag()
|
||||
{
|
||||
ParseBlockTest("<a><b></b></a><c></c>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesUntilMatchingEndTagIfFirstNonWhitespaceCharacterIsStartTag()
|
||||
public void ParsesUntilMatchingEndTagIfFirstNonWhitespaceCharacterIsStartTag()
|
||||
{
|
||||
ParseBlockTest("<baz><boz><biz></biz></boz></baz>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsUnclosedTagsAsLongAsItCanRecoverToAnExpectedEndTag()
|
||||
public void AllowsUnclosedTagsAsLongAsItCanRecoverToAnExpectedEndTag()
|
||||
{
|
||||
ParseBlockTest("<foo><bar><baz></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockWithSelfClosingTagJustEmitsTag()
|
||||
public void WithSelfClosingTagJustEmitsTag()
|
||||
{
|
||||
ParseBlockTest("<foo />");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCanHandleSelfClosingTagsWithinBlock()
|
||||
public void CanHandleSelfClosingTagsWithinBlock()
|
||||
{
|
||||
ParseBlockTest("<foo><bar /></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsTagsWithAttributes()
|
||||
public void SupportsTagsWithAttributes()
|
||||
{
|
||||
ParseBlockTest("<foo bar=\"baz\"><biz><boz zoop=zork/></biz></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsCloseAngleBracketInAttributeValueIfDoubleQuoted()
|
||||
public void AllowsCloseAngleBracketInAttributeValueIfDoubleQuoted()
|
||||
{
|
||||
ParseBlockTest("<foo><bar baz=\">\" /></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsCloseAngleBracketInAttributeValueIfSingleQuoted()
|
||||
public void AllowsCloseAngleBracketInAttributeValueIfSingleQuoted()
|
||||
{
|
||||
ParseBlockTest("<foo><bar baz=\'>\' /></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsSlashInAttributeValueIfDoubleQuoted()
|
||||
public void AllowsSlashInAttributeValueIfDoubleQuoted()
|
||||
{
|
||||
ParseBlockTest("<foo><bar baz=\"/\"></bar></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAllowsSlashInAttributeValueIfSingleQuoted()
|
||||
public void AllowsSlashInAttributeValueIfSingleQuoted()
|
||||
{
|
||||
ParseBlockTest("<foo><bar baz=\'/\'></bar></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesAtEOF()
|
||||
public void TerminatesAtEOF()
|
||||
{
|
||||
ParseBlockTest("<foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCommentAsBlock()
|
||||
public void SupportsCommentAsBlock()
|
||||
{
|
||||
ParseBlockTest("<!-- foo -->");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCommentWithExtraDashAsBlock()
|
||||
public void SupportsCommentWithExtraDashAsBlock()
|
||||
{
|
||||
ParseBlockTest("<!-- foo --->");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCommentWithinBlock()
|
||||
public void SupportsCommentWithinBlock()
|
||||
{
|
||||
ParseBlockTest("<foo>bar<!-- zoop -->baz</foo>");
|
||||
}
|
||||
|
|
@ -155,116 +155,117 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockProperlyBalancesCommentStartAndEndTags()
|
||||
public void ProperlyBalancesCommentStartAndEndTags()
|
||||
{
|
||||
ParseBlockTest("<!--<foo></bar>-->");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesAtEOFWhenParsingComment()
|
||||
public void TerminatesAtEOFWhenParsingComment()
|
||||
{
|
||||
ParseBlockTest("<!--<foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockOnlyTerminatesCommentOnFullEndSequence()
|
||||
public void OnlyTerminatesCommentOnFullEndSequence()
|
||||
{
|
||||
ParseBlockTest("<!--<foo>--</bar>-->");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesCommentAtFirstOccurrenceOfEndSequence()
|
||||
public void TerminatesCommentAtFirstOccurrenceOfEndSequence()
|
||||
{
|
||||
ParseBlockTest("<foo><!--<foo></bar-->--></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTreatsMalformedTagsAsContent()
|
||||
public void TreatsMalformedTagsAsContent()
|
||||
{
|
||||
ParseBlockTest("<foo></!-- bar --></foo>");
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesSGMLDeclarationAsEmptyTag()
|
||||
public void ParsesSGMLDeclarationAsEmptyTag()
|
||||
{
|
||||
ParseBlockTest("<foo><!DOCTYPE foo bar baz></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesSGMLDeclarationAtFirstCloseAngle()
|
||||
public void TerminatesSGMLDeclarationAtFirstCloseAngle()
|
||||
{
|
||||
ParseBlockTest("<foo><!DOCTYPE foo bar> baz></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesXMLProcessingInstructionAsEmptyTag()
|
||||
public void ParsesXMLProcessingInstructionAsEmptyTag()
|
||||
{
|
||||
ParseBlockTest("<foo><?xml foo bar baz?></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTerminatesXMLProcessingInstructionAtQuestionMarkCloseAnglePair()
|
||||
public void TerminatesXMLProcessingInstructionAtQuestionMarkCloseAnglePair()
|
||||
{
|
||||
ParseBlockTest("<foo><?xml foo bar baz?> baz</foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockDoesNotTerminateXMLProcessingInstructionAtCloseAngleUnlessPreceededByQuestionMark()
|
||||
public void DoesNotTerminateXMLProcInstrAtCloseAngleUnlessPreceededByQuestionMark()
|
||||
{
|
||||
// ParseBlockDoesNotTerminateXMLProcessingInstructionAtCloseAngleUnlessPreceededByQuestionMark
|
||||
ParseBlockTest("<foo><?xml foo bar> baz?></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsScriptTagsWithLessThanSignsInThem()
|
||||
public void SupportsScriptTagsWithLessThanSignsInThem()
|
||||
{
|
||||
ParseBlockTest(@"<script>if(foo<bar) { alert(""baz"");)</script>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsScriptTagsWithSpacedLessThanSignsInThem()
|
||||
public void SupportsScriptTagsWithSpacedLessThanSignsInThem()
|
||||
{
|
||||
ParseBlockTest(@"<script>if(foo < bar) { alert(""baz"");)</script>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAcceptsEmptyTextTag()
|
||||
public void AcceptsEmptyTextTag()
|
||||
{
|
||||
ParseBlockTest("<text/>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockAcceptsTextTagAsOuterTagButDoesNotRender()
|
||||
public void AcceptsTextTagAsOuterTagButDoesNotRender()
|
||||
{
|
||||
ParseBlockTest("<text>Foo Bar <foo> Baz</text> zoop");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockRendersLiteralTextTagIfDoubled()
|
||||
public void RendersLiteralTextTagIfDoubled()
|
||||
{
|
||||
ParseBlockTest("<text><text>Foo Bar <foo> Baz</text></text> zoop");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockDoesNotConsiderPsuedoTagWithinMarkupBlock()
|
||||
public void DoesNotConsiderPsuedoTagWithinMarkupBlock()
|
||||
{
|
||||
ParseBlockTest("<foo><text><bar></bar></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStopsParsingMidEmptyTagIfEOFReached()
|
||||
public void StopsParsingMidEmptyTagIfEOFReached()
|
||||
{
|
||||
ParseBlockTest("<br/");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockCorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement()
|
||||
public void CorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement()
|
||||
{
|
||||
ParseBlockTest("<div>Foo @if(true) {} Bar</div>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockIgnoresTagsInContentsOfScriptTag()
|
||||
public void IgnoresTagsInContentsOfScriptTag()
|
||||
{
|
||||
ParseBlockTest(@"<script>foo<bar baz='@boz'></script>");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,43 +13,43 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
private static readonly TestFile Nested1000 = TestFile.Create("TestFiles/nested-1000.html", typeof(HtmlDocumentTest));
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_NestedCodeBlockWithMarkupSetsDotAsMarkup()
|
||||
public void NestedCodeBlockWithMarkupSetsDotAsMarkup()
|
||||
{
|
||||
ParseDocumentTest("@if (true) { @if(false) { <div>@something.</div> } }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentOutputsEmptyBlockWithEmptyMarkupSpanIfContentIsEmptyString()
|
||||
public void OutputsEmptyBlockWithEmptyMarkupSpanIfContentIsEmptyString()
|
||||
{
|
||||
ParseDocumentTest(string.Empty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentOutputsWhitespaceOnlyContentAsSingleWhitespaceMarkupSpan()
|
||||
public void OutputsWhitespaceOnlyContentAsSingleWhitespaceMarkupSpan()
|
||||
{
|
||||
ParseDocumentTest(" ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentAcceptsSwapTokenAtEndOfFileAndOutputsZeroLengthCodeSpan()
|
||||
public void AcceptsSwapTokenAtEndOfFileAndOutputsZeroLengthCodeSpan()
|
||||
{
|
||||
ParseDocumentTest("@");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentCorrectlyHandlesOddlySpacedHTMLElements()
|
||||
public void CorrectlyHandlesOddlySpacedHTMLElements()
|
||||
{
|
||||
ParseDocumentTest("<div ><p class = 'bar'> Foo </p></div >");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentCorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement()
|
||||
public void CorrectlyHandlesSingleLineOfMarkupWithEmbeddedStatement()
|
||||
{
|
||||
ParseDocumentTest("<div>Foo @if(true) {} Bar</div>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentWithinSectionDoesNotCreateDocumentLevelSpan()
|
||||
public void WithinSectionDoesNotCreateDocumentLevelSpan()
|
||||
{
|
||||
ParseDocumentTest("@section Foo {" + Environment.NewLine
|
||||
+ " <html></html>" + Environment.NewLine
|
||||
|
|
@ -58,25 +58,25 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentParsesWholeContentAsOneSpanIfNoSwapCharacterEncountered()
|
||||
public void ParsesWholeContentAsOneSpanIfNoSwapCharacterEncountered()
|
||||
{
|
||||
ParseDocumentTest("foo baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentHandsParsingOverToCodeParserWhenAtSignEncounteredAndEmitsOutput()
|
||||
public void HandsParsingOverToCodeParserWhenAtSignEncounteredAndEmitsOutput()
|
||||
{
|
||||
ParseDocumentTest("foo @bar baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentEmitsAtSignAsMarkupIfAtEndOfFile()
|
||||
public void EmitsAtSignAsMarkupIfAtEndOfFile()
|
||||
{
|
||||
ParseDocumentTest("foo @");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentEmitsCodeBlockIfFirstCharacterIsSwapCharacter()
|
||||
public void EmitsCodeBlockIfFirstCharacterIsSwapCharacter()
|
||||
{
|
||||
ParseDocumentTest("@bar");
|
||||
}
|
||||
|
|
@ -84,107 +84,109 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
[Fact]
|
||||
public void ParseDocumentDoesNotSwitchToCodeOnEmailAddressInText()
|
||||
{
|
||||
ParseDocument("example@microsoft.com");
|
||||
ParseDocumentTest("example@microsoft.com");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotSwitchToCodeOnEmailAddressInAttribute()
|
||||
public void DoesNotSwitchToCodeOnEmailAddressInAttribute()
|
||||
{
|
||||
ParseDocumentTest("<a href=\"mailto:example@microsoft.com\">Email me</a>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotReturnErrorOnMismatchedTags()
|
||||
public void DoesNotReturnErrorOnMismatchedTags()
|
||||
{
|
||||
ParseDocumentTest("Foo <div><p></p></p> Baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentReturnsOneMarkupSegmentIfNoCodeBlocksEncountered()
|
||||
public void ReturnsOneMarkupSegmentIfNoCodeBlocksEncountered()
|
||||
{
|
||||
ParseDocumentTest("Foo Baz<!--Foo-->Bar<!--F> Qux");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentRendersTextPseudoTagAsMarkup()
|
||||
public void RendersTextPseudoTagAsMarkup()
|
||||
{
|
||||
ParseDocumentTest("Foo <text>Foo</text>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentAcceptsEndTagWithNoMatchingStartTag()
|
||||
public void AcceptsEndTagWithNoMatchingStartTag()
|
||||
{
|
||||
ParseDocumentTest("Foo </div> Bar");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentNoLongerSupportsDollarOpenBraceCombination()
|
||||
public void NoLongerSupportsDollarOpenBraceCombination()
|
||||
{
|
||||
ParseDocumentTest("<foo>${bar}</foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentIgnoresTagsInContentsOfScriptTag()
|
||||
public void IgnoresTagsInContentsOfScriptTag()
|
||||
{
|
||||
ParseDocumentTest(@"<script>foo<bar baz='@boz'></script>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotRenderExtraNewLineAtTheEndOfVerbatimBlock()
|
||||
public void DoesNotRenderExtraNewLineAtTheEndOfVerbatimBlock()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n}\r\n<html>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotRenderExtraWhitespaceAndNewLineAtTheEndOfVerbatimBlock()
|
||||
public void DoesNotRenderExtraWhitespaceAndNewLineAtTheEndOfVerbatimBlock()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n} \t\r\n<html>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotRenderExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByCSharp()
|
||||
public void DoesNotRenderNewlineAfterTextTagInVerbatimBlockIfFollowedByCSharp()
|
||||
{
|
||||
// ParseDocumentDoesNotRenderExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByCSharp
|
||||
ParseDocumentTest("@{<text>Blah</text>\r\n\r\n}<html>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentRendersExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByHtml()
|
||||
public void RendersExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByHtml()
|
||||
{
|
||||
ParseDocumentTest("@{<text>Blah</text>\r\n<input/>\r\n}<html>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentRendersExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByMarkupTransition()
|
||||
public void RendersNewlineAfterTextTagInVerbatimBlockIfFollowedByMarkupTransition()
|
||||
{
|
||||
// ParseDocumentRendersExtraNewlineAtTheEndTextTagInVerbatimBlockIfFollowedByMarkupTransition
|
||||
ParseDocumentTest("@{<text>Blah</text>\r\n@: Bleh\r\n}<html>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotIgnoreNewLineAtTheEndOfMarkupBlock()
|
||||
public void DoesNotIgnoreNewLineAtTheEndOfMarkupBlock()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n}\r\n<html>\r\n");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentDoesNotIgnoreWhitespaceAtTheEndOfVerbatimBlockIfNoNewlinePresent()
|
||||
public void DoesNotIgnoreWhitespaceAtTheEndOfVerbatimBlockIfNoNewlinePresent()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n} \t<html>\r\n");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentHandlesNewLineInNestedBlock()
|
||||
public void HandlesNewLineInNestedBlock()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n@if(true){\r\n} \r\n}\r\n<html>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentHandlesNewLineAndMarkupInNestedBlock()
|
||||
public void HandlesNewLineAndMarkupInNestedBlock()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n@if(true){\r\n} <input> }");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocumentHandlesExtraNewLineBeforeMarkupInNestedBlock()
|
||||
public void HandlesExtraNewLineBeforeMarkupInNestedBlock()
|
||||
{
|
||||
ParseDocumentTest("@{\r\n@if(true){\r\n} \r\n<input> \r\n}<html>");
|
||||
}
|
||||
|
|
@ -207,56 +209,56 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionInAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionInAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='@@' />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='abc@@' />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='@@def' />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionBetweenAttributeValue_DoesNotThrow()
|
||||
public void WithDoubleTransitionBetweenAttributeValue_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='abc @@ def' />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionWithExpressionBlock_DoesNotThrow()
|
||||
public void WithDoubleTransitionWithExpressionBlock_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='@@@(2+3)' bar='@(2+3)@@@DateTime.Now' baz='@DateTime.Now@@' bat='@DateTime.Now @@' zoo='@@@DateTime.Now' />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionInEmail_DoesNotThrow()
|
||||
public void WithDoubleTransitionInEmail_DoesNotThrow()
|
||||
{
|
||||
var input = "{<span foo='abc@def.com abc@@def.com @@' />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithDoubleTransitionInRegex_DoesNotThrow()
|
||||
public void WithDoubleTransitionInRegex_DoesNotThrow()
|
||||
{
|
||||
var input = @"{<span foo=""/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@@[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i"" />}";
|
||||
ParseDocumentTest(input);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseDocument_WithUnexpectedTransitionsInAttributeValue_Throws()
|
||||
public void WithUnexpectedTransitionsInAttributeValue_Throws()
|
||||
{
|
||||
ParseDocumentTest("<span foo='@ @' />");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,49 +8,51 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class HtmlErrorTest : CsHtmlMarkupParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockAllowsInvalidTagNamesAsLongAsParserCanIdentifyEndTag()
|
||||
public void AllowsInvalidTagNamesAsLongAsParserCanIdentifyEndTag()
|
||||
{
|
||||
ParseBlockTest("<1-foo+bar>foo</1-foo+bar>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockThrowsErrorIfStartTextTagContainsTextAfterName()
|
||||
public void ThrowsErrorIfStartTextTagContainsTextAfterName()
|
||||
{
|
||||
ParseBlockTest("<text foo bar></text>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockThrowsErrorIfEndTextTagContainsTextAfterName()
|
||||
public void ThrowsErrorIfEndTextTagContainsTextAfterName()
|
||||
{
|
||||
ParseBlockTest("<text></text foo bar>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockThrowsExceptionIfBlockDoesNotStartWithTag()
|
||||
public void ThrowsExceptionIfBlockDoesNotStartWithTag()
|
||||
{
|
||||
ParseBlockTest("foo bar <baz>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockStartingWithEndTagProducesRazorErrorThenOutputsMarkupSegmentAndEndsBlock()
|
||||
public void StartingWithEndTagErrorsThenOutputsMarkupSegmentAndEndsBlock()
|
||||
{
|
||||
// ParseBlockStartingWithEndTagProducesRazorErrorThenOutputsMarkupSegmentAndEndsBlock
|
||||
ParseBlockTest("</foo> bar baz");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockWithUnclosedTopLevelTagThrowsMissingEndTagParserExceptionOnOutermostUnclosedTag()
|
||||
public void WithUnclosedTopLevelTagThrowsOnOutermostUnclosedTag()
|
||||
{
|
||||
// ParseBlockWithUnclosedTopLevelTagThrowsMissingEndTagParserExceptionOnOutermostUnclosedTag
|
||||
ParseBlockTest("<p><foo></bar>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockWithUnclosedTagAtEOFThrowsMissingEndTagException()
|
||||
public void WithUnclosedTagAtEOFThrowsMissingEndTagException()
|
||||
{
|
||||
ParseBlockTest("<foo>blah blah blah blah blah");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockWithUnfinishedTagAtEOFThrowsIncompleteTagException()
|
||||
public void WithUnfinishedTagAtEOFThrowsIncompleteTagException()
|
||||
{
|
||||
ParseBlockTest("<foo bar=baz");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Razor.Language.Extensions;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -11,31 +10,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class HtmlToCodeSwitchTest : CsHtmlMarkupParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ParseBlockSwitchesWhenCharacterBeforeSwapIsNonAlphanumeric()
|
||||
public void SwitchesWhenCharacterBeforeSwapIsNonAlphanumeric()
|
||||
{
|
||||
ParseBlockTest("<p>foo#@i</p>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSwitchesToCodeWhenSwapCharacterEncounteredMidTag()
|
||||
public void SwitchesToCodeWhenSwapCharacterEncounteredMidTag()
|
||||
{
|
||||
ParseBlockTest("<foo @bar />");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSwitchesToCodeWhenSwapCharacterEncounteredInAttributeValue()
|
||||
public void SwitchesToCodeWhenSwapCharacterEncounteredInAttributeValue()
|
||||
{
|
||||
ParseBlockTest("<foo bar=\"@baz\" />");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSwitchesToCodeWhenSwapCharacterEncounteredInTagContent()
|
||||
public void SwitchesToCodeWhenSwapCharacterEncounteredInTagContent()
|
||||
{
|
||||
ParseBlockTest("<foo>@bar<baz>@boz</baz></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockParsesCodeWithinSingleLineMarkup()
|
||||
public void ParsesCodeWithinSingleLineMarkup()
|
||||
{
|
||||
// TODO: Fix at a later date, HTML should be a tag block: https://github.com/aspnet/Razor/issues/101
|
||||
ParseBlockTest("@:<li>Foo @Bar Baz" + Environment.NewLine
|
||||
|
|
@ -43,25 +42,25 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCodeWithinComment()
|
||||
public void SupportsCodeWithinComment()
|
||||
{
|
||||
ParseBlockTest("<foo><!-- @foo --></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCodeWithinSGMLDeclaration()
|
||||
public void SupportsCodeWithinSGMLDeclaration()
|
||||
{
|
||||
ParseBlockTest("<foo><!DOCTYPE foo @bar baz></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCodeWithinCDataDeclaration()
|
||||
public void SupportsCodeWithinCDataDeclaration()
|
||||
{
|
||||
ParseBlockTest("<foo><![CDATA[ foo @bar baz]]></foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockSupportsCodeWithinXMLProcessingInstruction()
|
||||
public void SupportsCodeWithinXMLProcessingInstruction()
|
||||
{
|
||||
ParseBlockTest("<foo><?xml foo @bar baz?></foo>");
|
||||
}
|
||||
|
|
@ -73,13 +72,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockDoesNotSwitchToCodeOnEmailAddressInAttribute()
|
||||
public void DoesNotSwitchToCodeOnEmailAddressInAttribute()
|
||||
{
|
||||
ParseBlockTest("<a href=\"mailto:anurse@microsoft.com\">Email me</a>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockGivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine()
|
||||
public void GivesWhitespacePreceedingAtToCodeIfThereIsNoMarkupOnThatLine()
|
||||
{
|
||||
ParseBlockTest(" <ul>" + Environment.NewLine
|
||||
+ " @foreach(var p in Products) {" + Environment.NewLine
|
||||
|
|
@ -125,13 +124,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
|
||||
// Tests for "@@" escape sequence:
|
||||
[Fact]
|
||||
public void ParseBlockTreatsTwoAtSignsAsEscapeSequence()
|
||||
public void TreatsTwoAtSignsAsEscapeSequence()
|
||||
{
|
||||
ParseBlockTest("<foo>@@bar</foo>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseBlockTreatsPairsOfAtSignsAsEscapeSequence()
|
||||
public void TreatsPairsOfAtSignsAsEscapeSequence()
|
||||
{
|
||||
ParseBlockTest("<foo>@@@@@bar</foo>");
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
public class WhiteSpaceRewriterTest : CsHtmlMarkupParserTestBase
|
||||
{
|
||||
[Fact]
|
||||
public void Rewrite_Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block()
|
||||
public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block()
|
||||
{
|
||||
// Arrange
|
||||
var parsed = ParseDocument(
|
||||
|
|
|
|||
|
|
@ -110,10 +110,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
throw new InvalidOperationException(message);
|
||||
}
|
||||
|
||||
var baselineFileName = Path.ChangeExtension(FileName, ".syntaxtree.txt");
|
||||
var baselineDiagnosticsFileName = Path.ChangeExtension(FileName, ".diagnostics.txt");
|
||||
var baselineClassifiedSpansFileName = Path.ChangeExtension(FileName, ".classifiedspans.txt");
|
||||
var baselineTagHelperSpansFileName = Path.ChangeExtension(FileName, ".taghelperspans.txt");
|
||||
var baselineFileName = Path.ChangeExtension(FileName, ".stree.txt");
|
||||
var baselineDiagnosticsFileName = Path.ChangeExtension(FileName, ".diag.txt");
|
||||
var baselineClassifiedSpansFileName = Path.ChangeExtension(FileName, ".cspans.txt");
|
||||
var baselineTagHelperSpansFileName = Path.ChangeExtension(FileName, ".tspans.txt");
|
||||
|
||||
if (GenerateBaselines)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue