File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
src/libraries/Microsoft.Extensions.FileSystemGlobbing Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,17 @@ public struct FilePatternMatch : IEquatable<FilePatternMatch>
2828 /// If the matcher searched for "src/Project/**/*.cs" and the pattern matcher found "src/Project/Interfaces/IFile.cs",
2929 /// then <see cref="Stem" /> = "Interfaces/IFile.cs" and <see cref="Path" /> = "src/Project/Interfaces/IFile.cs".
3030 /// </remarks>
31- public string ? Stem { get ; }
31+ public string Stem { get ; }
3232
3333 /// <summary>
3434 /// Initializes new instance of <see cref="FilePatternMatch" />
3535 /// </summary>
3636 /// <param name="path">The path to the file matched, relative to the beginning of the matching search pattern.</param>
3737 /// <param name="stem">The subpath to the file matched, relative to the first wildcard in the matching search pattern.</param>
38- public FilePatternMatch ( string path , string ? stem )
38+ public FilePatternMatch ( string path , string stem )
3939 {
4040 ArgumentNullException . ThrowIfNull ( path ) ;
41+ ArgumentNullException . ThrowIfNull ( stem ) ;
4142
4243 Path = path ;
4344 Stem = stem ;
Original file line number Diff line number Diff line change 11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4+ using System . Diagnostics . CodeAnalysis ;
5+
46namespace Microsoft . Extensions . FileSystemGlobbing . Internal
57{
68 /// <summary>
@@ -11,6 +13,7 @@ public struct PatternTestResult
1113 {
1214 public static readonly PatternTestResult Failed = new ( isSuccessful : false , stem : null ) ;
1315
16+ [ MemberNotNullWhen ( returnValue : true , nameof ( Stem ) ) ]
1417 public bool IsSuccessful { get ; }
1518 public string ? Stem { get ; }
1619
Original file line number Diff line number Diff line change 11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4+ using System ;
45using Xunit ;
56
67namespace Microsoft . Extensions . FileSystemGlobbing . Tests
@@ -24,5 +25,17 @@ public void TestGetHashCode()
2425 FilePatternMatch matchCase2 = new FilePatternMatch ( "sub/sub2/bar/baz/three.txt" , "Sub2/bar/baz/thrEE.txt" ) ;
2526 Assert . Equal ( matchCase1 . GetHashCode ( ) , matchCase2 . GetHashCode ( ) ) ;
2627 }
28+
29+ [ Fact ]
30+ public void TestPathArgumentNullExceptions ( )
31+ {
32+ Assert . Throws < ArgumentNullException > ( ( ) => new FilePatternMatch ( null , "sub2/bar/baz/three.txt" ) ) ;
33+ }
34+
35+ [ Fact ]
36+ public void TestStemArgumentNullExceptions ( )
37+ {
38+ Assert . Throws < ArgumentNullException > ( ( ) => new FilePatternMatch ( "sub2/bar/baz/three.txt" , null ) ) ;
39+ }
2740 }
2841}
You can’t perform that action at this time.
0 commit comments