Skip to content

Commit c0dbda2

Browse files
committed
Update embedded language
1 parent cc07fac commit c0dbda2

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/Framework/AspNetCoreAnalyzers/src/Analyzers/Infrastructure/RoutePattern/RoutePatternOptions.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ private RoutePatternOptions() { }
2929

3030
public static readonly RoutePatternOptions ComponentsRoute = new RoutePatternOptions
3131
{
32-
AdditionalInvalidParameterCharacters = new[] { '{', '}', '=', '.' }
32+
SupportComplexSegments = true,
33+
SupportDefaultValues = true,
34+
SupportTwoAsteriskCatchAll = true,
3335
};
3436
}

src/Framework/AspNetCoreAnalyzers/test/RouteEmbeddedLanguage/RoutePatternParserTests_ComponentsTests.cs

+1-12
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ public void Parse_MixedLiteralParameterAndCatchAllParameter()
184184
[InlineData("{p*}")]
185185
[InlineData("{{}")]
186186
[InlineData("{}}")]
187-
[InlineData("{=}")]
188-
[InlineData("{.}")]
189187
public void Components_ParseRouteParameter_ThrowsIf_ParameterContainsSpecialCharacters(string template)
190188
{
191189
var tree = Test(@"""" + template + @"""", routePatternOptions: RoutePatternOptions.ComponentsRoute, allowDiagnosticsMismatch: true);
@@ -286,7 +284,7 @@ public void InvalidTemplate_NonOptionalParamAfterOptionalParam()
286284
}
287285

288286
[Fact]
289-
public void InvalidTemplate_CatchAllParamWithMultipleAsterisks()
287+
public void Template_CatchAllParamWithMultipleAsterisks()
290288
{
291289
Test(@"""/test/{a}/{**b}""", @"<Tree>
292290
<CompilationUnit>
@@ -327,9 +325,6 @@ public void InvalidTemplate_CatchAllParamWithMultipleAsterisks()
327325
</Segment>
328326
<EndOfFile />
329327
</CompilationUnit>
330-
<Diagnostics>
331-
<Diagnostic Message=""A catch-all parameter may only have one '*' at the beginning of the segment."" Span=""[20..22)"" Text=""**"" />
332-
</Diagnostics>
333328
<Parameters>
334329
<Parameter Name=""a"" IsCatchAll=""false"" IsOptional=""false"" EncodeSlashes=""true"" />
335330
<Parameter Name=""b"" IsCatchAll=""true"" IsOptional=""false"" EncodeSlashes=""false"" />
@@ -458,9 +453,6 @@ public void Components_TestParameterWithDefault()
458453
</Segment>
459454
<EndOfFile />
460455
</CompilationUnit>
461-
<Diagnostics>
462-
<Diagnostic Message=""A parameter with a default value isn't supported."" Span=""[12..17)"" Text=""=Home"" />
463-
</Diagnostics>
464456
<Parameters>
465457
<Parameter Name=""id"" IsCatchAll=""false"" IsOptional=""false"" EncodeSlashes=""true"" DefaultValue=""Home"" />
466458
</Parameters>
@@ -496,9 +488,6 @@ public void Components_Parse_ComplexSegment_OptionalParameterFollowingPeriod()
496488
</Segment>
497489
<EndOfFile />
498490
</CompilationUnit>
499-
<Diagnostics>
500-
<Diagnostic Message=""Complex segment is not supported."" Span=""[9..19)"" Text=""{p1}.{p2?}"" />
501-
</Diagnostics>
502491
<Parameters>
503492
<Parameter Name=""p1"" IsCatchAll=""false"" IsOptional=""false"" EncodeSlashes=""true"" />
504493
<Parameter Name=""p2"" IsCatchAll=""false"" IsOptional=""true"" EncodeSlashes=""true"" />

0 commit comments

Comments
 (0)