File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,15 @@ Describe "AvoidAssignmentToAutomaticVariables" {
7171 $warnings.RuleName | Should - Be $ruleName
7272 }
7373
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+
7483 It " Using Variable <VariableName> as parameter name produces warning of Severity error" - TestCases $testCases_AutomaticVariables {
7584 param ($VariableName , $ExpectedSeverity )
7685
You can’t perform that action at this time.
0 commit comments