Skip to content

Commit 68840ac

Browse files
committed
Add PSUseDeclaredVarsMoreThanAssignments test for strongly typed variables
1 parent faf4886 commit 68840ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Tests/Rules/UseDeclaredVarsMoreThanAssignments.tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ function MyFunc2() {
3838
Should Be 1
3939
}
4040

41+
It "flags strongly typed variables" {
42+
Invoke-ScriptAnalyzer -ScriptDefinition '[string]$s=''mystring''' -IncludeRule $violationName | `
43+
Get-Count | `
44+
Should Be 1
45+
}
46+
4147
It "does not flag `$InformationPreference variable" {
4248
Invoke-ScriptAnalyzer -ScriptDefinition '$InformationPreference=Stop' -IncludeRule $violationName | `
4349
Get-Count | `

0 commit comments

Comments
 (0)