From ada7d12ce4283bc8651656380bd2540f67d2b7ba Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Wed, 13 Feb 2019 14:47:03 -0800 Subject: [PATCH] Fix test failure in PSv3/4 --- Tests/Rules/UseCompatibleSyntax.Tests.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Tests/Rules/UseCompatibleSyntax.Tests.ps1 b/Tests/Rules/UseCompatibleSyntax.Tests.ps1 index d4ccd36a0..602e674ad 100644 --- a/Tests/Rules/UseCompatibleSyntax.Tests.ps1 +++ b/Tests/Rules/UseCompatibleSyntax.Tests.ps1 @@ -84,7 +84,16 @@ Describe "PSUseCompatibleSyntax" { $diagnostics = Invoke-ScriptAnalyzer -IncludeRule PSUseCompatibleSyntax -Path "$PSScriptRoot/CompatibilityRuleAssets/IncompatibleScript.ps1" -Settings $settings - $diagnostics.Count | Should -Be 5 + if ($PSVersionTable.PSVersion.Major -ge 5) + { + $expected = 5 + } + else + { + $expected = 4 + } + + $diagnostics.Count | Should -Be $expected } It "Ensures there are no incompatibilities in PSSA build files" {