Skip to content

Commit a868ed5

Browse files
author
Kapil Borle
committed
Add configuration in each test case
1 parent 3450c95 commit a868ed5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Tests/Rules/UseWhitespace.tests.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ $ruleName = "PSUseWhitespace"
33
$ruleConfiguration = @{
44
Enable = $true
55
CheckOpenBrace = $true
6+
CheckOpenParen = $true
67
}
78

89
$settings = @{
@@ -18,6 +19,8 @@ Describe "UseWhitespace" {
1819
$def = @'
1920
if ($true){}
2021
'@
22+
$ruleConfiguration.CheckOpenParen = $false
23+
$ruleConfiguration.CheckOpenBrace = $true
2124
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
2225
}
2326

@@ -31,6 +34,8 @@ if ($true){}
3134
$def = @'
3235
if($true) {}
3336
'@
37+
$ruleConfiguration.CheckOpenParen = $true
38+
$ruleConfiguration.CheckOpenBrace = $false
3439
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
3540
}
3641

@@ -46,6 +51,8 @@ function foo($param1) {
4651
4752
}
4853
'@
54+
$ruleConfiguration.CheckOpenParen = $true
55+
$ruleConfiguration.CheckOpenBrace = $false
4956
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
5057
}
5158

@@ -61,6 +68,8 @@ function foo() {
6168
param( )
6269
}
6370
'@
71+
$ruleConfiguration.CheckOpenParen = $true
72+
$ruleConfiguration.CheckOpenBrace = $false
6473
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
6574
}
6675

@@ -76,6 +85,8 @@ function foo($param) {
7685
((Get-Process))
7786
}
7887
'@
88+
$ruleConfiguration.CheckOpenParen = $true
89+
$ruleConfiguration.CheckOpenBrace = $false
7990
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
8091
}
8192

0 commit comments

Comments
 (0)