File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,15 @@ Describe "AvoidAssignmentToAutomaticVariables" {
71
71
$warnings.RuleName | Should - Be $ruleName
72
72
}
73
73
74
+ It " Using Variable <VariableName> as foreach name produces warning of Severity <ExpectedSeverity>" - TestCases $testCases_AutomaticVariables {
75
+ param ($VariableName , $ExpectedSeverity )
76
+
77
+ [System.Array ] $warnings = Invoke-ScriptAnalyzer - ScriptDefinition " foreach (`$ $VariableName in `$ foo) {}" - ExcludeRule PSReviewUnusedParameter
78
+ $warnings.Count | Should - Be 1
79
+ $warnings.Severity | Should - Be $ExpectedSeverity
80
+ $warnings.RuleName | Should - Be $ruleName
81
+ }
82
+
74
83
It " Using Variable <VariableName> as parameter name produces warning of Severity error" - TestCases $testCases_AutomaticVariables {
75
84
param ($VariableName , $ExpectedSeverity )
76
85
You can’t perform that action at this time.
0 commit comments