Skip to content

Commit

Permalink
Try to preserve Pester function
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmholt committed Jul 15, 2021
1 parent e7f1c57 commit 1f8f793
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Tests/PSScriptAnalyzerTestHelper.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$script:SafeShould = (Get-Command -Module Pester -Name Should -ErrorAction Stop)

Function Get-ExtentTextFromContent
{
Param(
Expand Down Expand Up @@ -45,14 +47,12 @@ Function Test-CorrectionExtentFromContent {
[string] $correctionText
)

Import-Module Pester -ErrorAction Stop


$corrections = $diagnosticRecord.SuggestedCorrections
$corrections.Count | Should -Be $correctionsCount
$corrections[0].Text | Should -Be $correctionText
Get-ExtentTextFromContent $corrections[0] $rawContent | `
Should -Be $violationText
$extent = Get-ExtentTextFromContent $corrections[0] $rawContent

& $script:SafeShould -ActualValue $extent -Be $violationText
}

Function Get-Count
Expand Down

0 comments on commit 1f8f793

Please sign in to comment.