@@ -99,5 +99,27 @@ public void GetRelativePath_WithBaseDirectoryMatchingIncompletePortionOfFullPath
99
99
100
100
Assert . Equal ( expected : @"..\Beta2\Gamma" , actual : result ) ;
101
101
}
102
+
103
+ [ ConditionalTheory ( typeof ( WindowsOnly ) ) , WorkItem ( 72043 , "https://github.com/dotnet/roslyn/issues/72043" ) ]
104
+ [ InlineData ( @"C:\Alpha" , @"C:\" , @".." ) ]
105
+ [ InlineData ( @"C:\Alpha\Beta" , @"C:\" , @"..\.." ) ]
106
+ [ InlineData ( @"C:\Alpha\Beta" , @"C:\Gamma" , @"..\..\Gamma" ) ]
107
+ public void GetRelativePath_WithFullPathShorterThanBasePath_Windows ( string baseDirectory , string fullPath , string expected )
108
+ {
109
+ var result = PathUtilities . GetRelativePath ( baseDirectory , fullPath ) ;
110
+
111
+ Assert . Equal ( expected , result ) ;
112
+ }
113
+
114
+ [ ConditionalTheory ( typeof ( UnixLikeOnly ) ) , WorkItem ( 72043 , "https://github.com/dotnet/roslyn/issues/72043" ) ]
115
+ [ InlineData ( "/Alpha" , "/" , ".." ) ]
116
+ [ InlineData ( "/Alpha/Beta" , "/" , "../.." ) ]
117
+ [ InlineData ( "/Alpha/Beta" , "/Gamma" , "../../Gamma" ) ]
118
+ public void GetRelativePath_WithFullPathShorterThanBasePath_Unix ( string baseDirectory , string fullPath , string expected )
119
+ {
120
+ var result = PathUtilities . GetRelativePath ( baseDirectory , fullPath ) ;
121
+
122
+ Assert . Equal ( expected , result ) ;
123
+ }
102
124
}
103
125
}
0 commit comments