@@ -108,7 +108,7 @@ Describe "Test importing correct customized rules" {
108108
109109 It " will show the custom rules when given glob with recurse switch" {
110110 $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
111- $customizedRulePath.Count | Should be 4
111+ $customizedRulePath.Count | Should be 3
112112 }
113113 }
114114
@@ -147,7 +147,7 @@ Describe "Test importing correct customized rules" {
147147
148148 It " will show the custom rules when given glob with recurse switch" {
149149 $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
150- $customizedRulePath.Count | Should be 4
150+ $customizedRulePath.Count | Should be 3
151151 }
152152
153153 It " Using IncludeDefaultRules Switch with CustomRulePath" {
@@ -164,23 +164,26 @@ Describe "Test importing correct customized rules" {
164164 $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1
165165 $customizedRulePath.Count | Should Be 1
166166 }
167+
168+ if ($PSVersionTable.PSVersion -ge [Version ]' 5.0' )
169+ {
170+ It " loads custom rules that contain version in their path" {
171+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \VersionedSampleRule\SampleRuleWithVersion
172+ $customizedRulePath.Count | Should Be 1
167173
168- It " loads custom rules that contain version in their path" {
169- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \SampleRuleWithVersion\SampleRuleWithVersion
170- $customizedRulePath.Count | Should Be 1
171-
172- $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \SampleRuleWithVersion\SampleRuleWithVersion
173- $customizedRulePath.Count | Should Be 1
174- }
174+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \VersionedSampleRule\SampleRuleWithVersion
175+ $customizedRulePath.Count | Should Be 1
176+ }
175177
176- It " loads custom rules that contain version in their path with the RecurseCustomRule switch" {
177- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \SampleRuleWithVersion - RecurseCustomRulePath
178- $customizedRulePath.Count | Should Be 1
178+ It " loads custom rules that contain version in their path with the RecurseCustomRule switch" {
179+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \VersionedSampleRule - RecurseCustomRulePath
180+ $customizedRulePath.Count | Should Be 1
179181
180- $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \SampleRuleWithVersion - RecurseCustomRulePath
181- $customizedRulePath.Count | Should Be 1
182+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \VersionedSampleRule - RecurseCustomRulePath
183+ $customizedRulePath.Count | Should Be 1
182184
183- }
185+ }
186+ }
184187 }
185188
186189 }
0 commit comments