Skip to content

Commit

Permalink
Use data driven test
Browse files Browse the repository at this point in the history
  • Loading branch information
kelleyma49 committed Dec 19, 2023
1 parent ae331c9 commit 9365853
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions PSFzf.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,15 @@ Describe "Find-CurrentPath" {
$rightCursor | Should -Be ($line.Length - 1)
}

It "Should Return Path With Quotes Cursor at Beginning" {
'"', "'" | ForEach-Object {
$quote = $_
$line = $quote + 'C:\Program Files\' + $quote ; $cursor = 0
$leftCursor = $rightCursor = $null
Find-CurrentPath $line $cursor ([ref]$leftCursor) ([ref]$rightCursor) | Should -Be 'C:\Program Files\'
$leftCursor | Should -Be 0
$rightCursor | Should -Be ($line.Length - 1)
}
}

It "Should Return Path With Quotes Cursor at End" {
'"', "'" | ForEach-Object {
$quote = $_
$line = $quote + 'C:\Program Files\' + $quote ; $cursor = 0
$leftCursor = $rightCursor = $null
Find-CurrentPath $line $cursor ([ref]$leftCursor) ([ref]$rightCursor) | Should -Be 'C:\Program Files\'
$leftCursor | Should -Be 0
$rightCursor | Should -Be ($line.Length - 1)
}
It "Should Return Path With Quotes Cursor at Beginning" -ForEach @(
@{ Quote = '"' }
@{ Quote = "'" }
) {
$line = $quote + 'C:\Program Files\' + $quote ; $cursor = 0
$leftCursor = $rightCursor = $null
Find-CurrentPath $line $cursor ([ref]$leftCursor) ([ref]$rightCursor) | Should -Be 'C:\Program Files\'
$leftCursor | Should -Be 0
$rightCursor | Should -Be ($line.Length - 1)
}
}
}
Expand Down

0 comments on commit 9365853

Please sign in to comment.