From 57029c7fc04faa48ec9a5deccbf0f1f61265a9cd Mon Sep 17 00:00:00 2001 From: Michael Kelley Date: Mon, 18 Dec 2023 23:34:06 -0800 Subject: [PATCH] Use data driven test (#238) --- PSFzf.tests.ps1 | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/PSFzf.tests.ps1 b/PSFzf.tests.ps1 index ef28cc1..43bb3ee 100644 --- a/PSFzf.tests.ps1 +++ b/PSFzf.tests.ps1 @@ -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) } } }