|
3 | 3 |
|
4 | 4 | #nullable disable |
5 | 5 |
|
6 | | -using System; |
7 | 6 | using System.Globalization; |
8 | 7 | using System.Linq; |
9 | 8 | using Microsoft.AspNetCore.Razor.Language.Components; |
@@ -2318,14 +2317,14 @@ public void InvalidCode_EmptyTransition() |
2318 | 2317 | // Assert |
2319 | 2318 | AssertDocumentNodeMatchesBaseline(generated.CodeDocument); |
2320 | 2319 | AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); |
2321 | | - CompileToAssembly(generated, DesignTime?[ |
| 2320 | + CompileToAssembly(generated, DesignTime ? [ |
2322 | 2321 | // x:\dir\subdir\Test\TestComponent.cshtml(3,7): error CS1525: Invalid expression term ';' |
2323 | 2322 | // __o = ; |
2324 | 2323 | Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(3, 7) |
2325 | 2324 | ] : [ |
2326 | | - // (24,36): error CS1525: Invalid expression term ')' |
2327 | | - // __builder.AddContent(3, |
2328 | | - Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments(")").WithLocation(24, 36) |
| 2325 | + // x:\dir\subdir\Test\TestComponent.cshtml(3,2): error CS1525: Invalid expression term ')' |
| 2326 | + // __builder.AddContent(3, |
| 2327 | + Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments(")").WithLocation(3, 2) |
2329 | 2328 | ]); |
2330 | 2329 | } |
2331 | 2330 |
|
@@ -2374,6 +2373,25 @@ @layout System.Object |
2374 | 2373 | CompileToAssembly(generated); |
2375 | 2374 | } |
2376 | 2375 |
|
| 2376 | + [IntegrationTestFact] |
| 2377 | + public void Component_AddContent_Multiline() |
| 2378 | + { |
| 2379 | + // Act |
| 2380 | + var generated = CompileToCSharp("""" |
| 2381 | + @(@"This |
| 2382 | + is |
| 2383 | + a |
| 2384 | + multiline |
| 2385 | + string") |
| 2386 | + """"); |
| 2387 | + |
| 2388 | + // Assert |
| 2389 | + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); |
| 2390 | + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); |
| 2391 | + var result = CompileToAssembly(generated); |
| 2392 | + AssertSequencePointsMatchBaseline(result, generated.CodeDocument); |
| 2393 | + } |
| 2394 | + |
2377 | 2395 | #endregion |
2378 | 2396 |
|
2379 | 2397 | #region Bind |
@@ -5069,7 +5087,8 @@ public class MyComponent : ComponentBase |
5069 | 5087 | // Assert |
5070 | 5088 | AssertDocumentNodeMatchesBaseline(generated.CodeDocument); |
5071 | 5089 | AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); |
5072 | | - CompileToAssembly(generated); |
| 5090 | + var result = CompileToAssembly(generated); |
| 5091 | + AssertSequencePointsMatchBaseline(result, generated.CodeDocument); |
5073 | 5092 | } |
5074 | 5093 |
|
5075 | 5094 | [IntegrationTestFact] |
@@ -5099,10 +5118,10 @@ public class MyComponent : ComponentBase |
5099 | 5118 | // Assert |
5100 | 5119 | AssertDocumentNodeMatchesBaseline(generated.CodeDocument); |
5101 | 5120 | AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); |
5102 | | - CompileToAssembly(generated); |
| 5121 | + var result = CompileToAssembly(generated); |
| 5122 | + AssertSequencePointsMatchBaseline(result, generated.CodeDocument); |
5103 | 5123 | } |
5104 | 5124 |
|
5105 | | - |
5106 | 5125 | [IntegrationTestFact] |
5107 | 5126 | public void ChildComponent_WithGenericChildContent_SetsParameterName() |
5108 | 5127 | { |
@@ -5318,7 +5337,8 @@ Some Content |
5318 | 5337 | // Assert |
5319 | 5338 | AssertDocumentNodeMatchesBaseline(generated.CodeDocument); |
5320 | 5339 | AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); |
5321 | | - CompileToAssembly(generated); |
| 5340 | + var result = CompileToAssembly(generated); |
| 5341 | + AssertSequencePointsMatchBaseline(result, generated.CodeDocument); |
5322 | 5342 | } |
5323 | 5343 |
|
5324 | 5344 | [IntegrationTestFact] |
@@ -5355,7 +5375,8 @@ public class MyComponent : ComponentBase |
5355 | 5375 | // Assert |
5356 | 5376 | AssertDocumentNodeMatchesBaseline(generated.CodeDocument); |
5357 | 5377 | AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); |
5358 | | - CompileToAssembly(generated); |
| 5378 | + var result = CompileToAssembly(generated); |
| 5379 | + AssertSequencePointsMatchBaseline(result, generated.CodeDocument); |
5359 | 5380 | } |
5360 | 5381 |
|
5361 | 5382 | [IntegrationTestFact] |
@@ -10605,9 +10626,9 @@ @layout MainLayout |
10605 | 10626 | // x:\dir\subdir\Test\_Imports.razor(5,2): error CS0103: The name 'Foo' does not exist in the current context |
10606 | 10627 | // Foo |
10607 | 10628 | Diagnostic(ErrorCode.ERR_NameNotInContext, "Foo").WithArguments("Foo").WithLocation(5, 2), |
10608 | | - // (33,13): error CS0103: The name '__builder' does not exist in the current context |
10609 | | - // __builder.AddContent(0, |
10610 | | - Diagnostic(ErrorCode.ERR_NameNotInContext, "__builder").WithArguments("__builder").WithLocation(41, 13)]); |
| 10629 | + // x:\dir\subdir\Test\_Imports.razor(5,2): error CS0103: The name '__builder' does not exist in the current context |
| 10630 | + // __builder.AddContent(0, Foo |
| 10631 | + Diagnostic(ErrorCode.ERR_NameNotInContext, "__builder").WithArguments("__builder").WithLocation(5, 2)]); |
10611 | 10632 | } |
10612 | 10633 |
|
10613 | 10634 | [IntegrationTestFact] |
|
0 commit comments