@@ -197,6 +197,95 @@ public void IncludedPathsWithAbsolutePaths()
197197 } ) ) ;
198198 }
199199
200+ [ Test ]
201+ public void IncludedPathsWithAbsolutePathsAndUnnecessaryWhiteSpace ( )
202+ {
203+ var directory = CreateTempDirectory ( ) ;
204+ var file1 = Path . Combine ( directory , "temp" , "file.txt" ) ;
205+ CreateTempFile ( file1 ) ;
206+
207+ var file2 = Path . Combine ( directory , "other path" , "temp" , "file.txt" ) ;
208+ CreateTempFile ( file2 ) ;
209+
210+ var file3 = Path . Combine ( directory , "file.txt" ) ;
211+ CreateTempFile ( file3 ) ;
212+
213+ Assert . That (
214+ PathUtilities . IncludedPaths ( file3 + " " , directory ) ,
215+ Is . EquivalentTo (
216+ new [ ]
217+ {
218+ file3
219+ } ) ) ;
220+ Assert . That (
221+ PathUtilities . IncludedPaths ( " " + file1 , directory ) ,
222+ Is . EquivalentTo (
223+ new [ ]
224+ {
225+ file1
226+ } ) ) ;
227+ Assert . That (
228+ PathUtilities . IncludedPaths (
229+ string . Format (
230+ CultureInfo . InvariantCulture ,
231+ " {0}\\ temp\\ *.txt " ,
232+ directory ) ,
233+ directory ) ,
234+ Is . EquivalentTo (
235+ new [ ]
236+ {
237+ file1 ,
238+ } ) ) ;
239+ Assert . That (
240+ PathUtilities . IncludedPaths (
241+ string . Format (
242+ CultureInfo . InvariantCulture ,
243+ " {0}\\ **\\ *.txt " ,
244+ directory ) ,
245+ directory ) ,
246+ Is . EquivalentTo (
247+ new [ ]
248+ {
249+ file1 ,
250+ file2 ,
251+ file3 ,
252+ } ) ) ;
253+ Assert . That (
254+ PathUtilities . IncludedPaths (
255+ string . Format (
256+ CultureInfo . InvariantCulture ,
257+ " {0}\\ other*\\ **\\ *.txt " ,
258+ directory ) ,
259+ directory ) ,
260+ Is . EquivalentTo (
261+ new [ ]
262+ {
263+ file2
264+ } ) ) ;
265+ Assert . That (
266+ PathUtilities . IncludedPaths (
267+ string . Format (
268+ CultureInfo . InvariantCulture ,
269+ " {0}\\ other\\ **\\ *.txt " ,
270+ directory ) ,
271+ directory ) ,
272+ Is . EquivalentTo (
273+ new string [ 0 ] ) ) ;
274+ Assert . That (
275+ PathUtilities . IncludedPaths (
276+ string . Format (
277+ CultureInfo . InvariantCulture ,
278+ " {0}\\ **\\ temp\\ *.txt " ,
279+ directory ) ,
280+ directory ) ,
281+ Is . EquivalentTo (
282+ new [ ]
283+ {
284+ file1 ,
285+ file2
286+ } ) ) ;
287+ }
288+
200289 [ Test ]
201290 public void IncludedPathsWithExclusionsAndAbsolutePaths ( )
202291 {
@@ -292,6 +381,101 @@ public void IncludedPathsWithExclusionsAndAbsolutePaths()
292381 } ) ) ;
293382 }
294383
384+ [ Test ]
385+ public void IncludedPathsWithExclusionsAndAbsolutePathsAndUnnecessaryWhiteSpace ( )
386+ {
387+ var directory = CreateTempDirectory ( ) ;
388+ var file1 = Path . Combine ( directory , "temp" , "file.txt" ) ;
389+ CreateTempFile ( file1 ) ;
390+
391+ var file2 = Path . Combine ( directory , "temp" , "other.txt" ) ;
392+ CreateTempFile ( file2 ) ;
393+
394+ var file3 = Path . Combine ( directory , "other path" , "temp" , "file.txt" ) ;
395+ CreateTempFile ( file3 ) ;
396+
397+ var file4 = Path . Combine ( directory , "other" , "temp" , "other.txt" ) ;
398+ CreateTempFile ( file4 ) ;
399+
400+ Assert . That (
401+ PathUtilities . IncludedPaths (
402+ string . Format (
403+ CultureInfo . InvariantCulture ,
404+ @" {0}\**\*.txt " ,
405+ directory ) ,
406+ Enumerable . Empty < string > ( ) ,
407+ directory ) ,
408+ Is . EquivalentTo (
409+ new [ ]
410+ {
411+ file1 ,
412+ file2 ,
413+ file3 ,
414+ file4 ,
415+ } ) ) ;
416+ Assert . That (
417+ PathUtilities . IncludedPaths (
418+ string . Format (
419+ CultureInfo . InvariantCulture ,
420+ @"{0}\**\*.txt " ,
421+ directory ) ,
422+ new [ ]
423+ {
424+ string . Format (
425+ CultureInfo . InvariantCulture ,
426+ @" {0}\other*\**\*.* " ,
427+ directory )
428+ } ,
429+ directory ) ,
430+ Is . EquivalentTo (
431+ new [ ]
432+ {
433+ file1 ,
434+ file2 ,
435+ } ) ) ;
436+ Assert . That (
437+ PathUtilities . IncludedPaths (
438+ string . Format (
439+ CultureInfo . InvariantCulture ,
440+ @" {0}\**\*.txt" ,
441+ directory ) ,
442+ new [ ]
443+ {
444+ string . Format (
445+ CultureInfo . InvariantCulture ,
446+ @"{0}\temp\other.* " ,
447+ directory )
448+ } ,
449+ directory ) ,
450+ Is . EquivalentTo (
451+ new [ ]
452+ {
453+ file1 ,
454+ file3 ,
455+ file4 ,
456+ } ) ) ;
457+ Assert . That (
458+ PathUtilities . IncludedPaths (
459+ string . Format (
460+ CultureInfo . InvariantCulture ,
461+ @"{0}\**\*.txt " ,
462+ directory ) ,
463+ new [ ]
464+ {
465+ string . Format (
466+ CultureInfo . InvariantCulture ,
467+ @" {0}\**\other.*" ,
468+ directory )
469+ } ,
470+ directory ) ,
471+ Is . EquivalentTo (
472+ new [ ]
473+ {
474+ file1 ,
475+ file3
476+ } ) ) ;
477+ }
478+
295479 [ Test ]
296480 public void IncludedPathsWithExclusionsAndRelativePaths ( )
297481 {
@@ -375,7 +559,6 @@ public void IncludedPathsWithExclusionsAndRelativePaths()
375559 } ) ) ;
376560 }
377561
378- // [Ignore("Ignoring files without directories doesn't work yet.")]
379562 [ Test ]
380563 public void IncludedPathsWithFileExclusions ( )
381564 {
@@ -392,7 +575,6 @@ public void IncludedPathsWithFileExclusions()
392575 var file4 = Path . Combine ( directory , "other" , "temp" , "other.txt" ) ;
393576 CreateTempFile ( file4 ) ;
394577
395- // This doesn't work yet
396578 Assert . That (
397579 PathUtilities . IncludedPaths (
398580 @"**\*.txt" ,
0 commit comments