Skip to content

Commit c2d6207

Browse files
authored
bug: Assert-AreEqualPath EndsWith '/' (#85)
1 parent 83f53dd commit c2d6207

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

public/Assert-path.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ function Assert-AreEqualPath {
1010
$ex = &{ if ($Expected | Test-Path) { $Expected | Convert-Path} else {$Expected} }
1111
$pr = &{ if ($Presented | Test-Path) { $Presented | Convert-Path} else {$Presented}}
1212

13+
# trim last '/' if exists
14+
if($ex.EndsWith('/')){ $ex = $ex.Substring(0, $ex.Length - 1) }
15+
if($pr.EndsWith('/')){ $pr = $pr.Substring(0, $pr.Length - 1) }
16+
1317
Assert-AreEqual -Expected $ex -Presented $pr -Comment ("Path not equal - " + $Comment)
1418
}
1519

@@ -25,6 +29,10 @@ function Assert-AreNotEqualPath {
2529
$ex = &{ if ($Expected | Test-Path) { $Expected | Convert-Path} else {$Expected} }
2630
$pr = &{ if ($Presented | Test-Path) { $Presented | Convert-Path} else {$Presented}}
2731

32+
# trim last '/' if exists
33+
if($ex.EndsWith('/')){ $ex = $ex.Substring(0, $ex.Length - 1) }
34+
if($pr.EndsWith('/')){ $pr = $pr.Substring(0, $pr.Length - 1) }
35+
2836
Assert-AreNotEqual -Expected $ex -Presented $pr -Comment ("Path equal - " + $Comment)
2937
}
3038

0 commit comments

Comments
 (0)