Skip to content

Commit 2f2f158

Browse files
author
Kapil Borle
committed
Add test case to check ignoring if-else block
1 parent 095767f commit 2f2f158

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Tests/Rules/PlaceCloseBrace.tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ $x = if ($true) { "blah" } else { "blah blah" }
118118
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
119119
$violations.Count | Should Be 0
120120
}
121+
122+
It "Should ignore violations for one line if statement even if NewLineAfter is true" {
123+
$def = @'
124+
$x = if ($true) { "blah" } else { "blah blah" }
125+
'@
126+
$ruleConfiguration.'IgnoreOneLineBlock' = $true
127+
$ruleConfiguration.'NewLineAfter' = $true
128+
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
129+
$violations.Count | Should Be 0
130+
}
121131
}
122132

123133
Context "When a close brace should be follow a new line" {

0 commit comments

Comments
 (0)