Skip to content

Commit 00e0884

Browse files
authored
Fix compatibility rule tests (#1697)
1 parent 06f94fb commit 00e0884

5 files changed

+477
-433
lines changed

Tests/PSScriptAnalyzerTestHelper.psm1

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$script:SafeShould = (Get-Command -Module Pester -Name Should -ErrorAction Stop)
2+
13
Function Get-ExtentTextFromContent
24
{
35
Param(
@@ -48,8 +50,9 @@ Function Test-CorrectionExtentFromContent {
4850
$corrections = $diagnosticRecord.SuggestedCorrections
4951
$corrections.Count | Should -Be $correctionsCount
5052
$corrections[0].Text | Should -Be $correctionText
51-
Get-ExtentTextFromContent $corrections[0] $rawContent | `
52-
Should -Be $violationText
53+
$extent = Get-ExtentTextFromContent $corrections[0] $rawContent
54+
55+
& $script:SafeShould -ActualValue $extent -Be $violationText
5356
}
5457

5558
Function Get-Count

0 commit comments

Comments
 (0)