@@ -27,6 +27,29 @@ namespace Microsoft.AspNetCore.StaticWebAssets.Tasks.Test;
2727// Recursive wildcard in the middle 'a/**/c'
2828public partial class StaticWebAssetGlobMatcherTest
2929{
30+ [ Theory ]
31+ [ InlineData ( "**/*.razor.js" , "Components/Pages/RegularComponent.razor.js" , "Components/Pages/RegularComponent.razor.js" ) ]
32+ [ InlineData ( "**/*.razor.js" , "Components/User.Profile.Details.razor.js" , "Components/User.Profile.Details.razor.js" ) ]
33+ [ InlineData ( "**/*.razor.js" , "Components/Area/Sub/Feature/User.Profile.Details.razor.js" , "Components/Area/Sub/Feature/User.Profile.Details.razor.js" ) ]
34+ [ InlineData ( "**/*.razor.js" , "Components/Area/Sub/Feature/Deep.Component.Name.With.Many.Parts.razor.js" , "Components/Area/Sub/Feature/Deep.Component.Name.With.Many.Parts.razor.js" ) ]
35+ [ InlineData ( "**/*.cshtml.js" , "Pages/Shared/_Host.cshtml.js" , "Pages/Shared/_Host.cshtml.js" ) ]
36+ [ InlineData ( "**/*.cshtml.js" , "Areas/Admin/Pages/Dashboard.cshtml.js" , "Areas/Admin/Pages/Dashboard.cshtml.js" ) ]
37+ [ InlineData ( "*.lib.module.js" , "Widget.lib.module.js" , "Widget.lib.module.js" ) ]
38+ [ InlineData ( "*.razor.css" , "Component.razor.css" , "Component.razor.css" ) ]
39+ [ InlineData ( "*.cshtml.css" , "View.cshtml.css" , "View.cshtml.css" ) ]
40+ [ InlineData ( "*.modules.json" , "app.modules.json" , "app.modules.json" ) ]
41+ [ InlineData ( "*.lib.module.js" , "Rcl.Client.Feature.lib.module.js" , "Rcl.Client.Feature.lib.module.js" ) ]
42+ public void Can_Match_WellKnownExistingPatterns ( string pattern , string path , string expectedStem )
43+ {
44+ var matcher = new StaticWebAssetGlobMatcherBuilder ( ) ;
45+ matcher . AddIncludePatterns ( pattern ) ;
46+ var globMatcher = matcher . Build ( ) ;
47+
48+ var match = globMatcher . Match ( path ) ;
49+ Assert . True ( match . IsMatch ) ;
50+ Assert . Equal ( pattern , match . Pattern ) ;
51+ Assert . Equal ( expectedStem , match . Stem ) ;
52+ }
3053 [ Fact ]
3154 public void CanMatchLiterals ( )
3255 {
0 commit comments