Skip to content

Commit a42fa1a

Browse files
author
Kapil Borle
committed
Test close brace in a one line if-else statement
1 parent 8210765 commit a42fa1a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Tests/Rules/PlaceCloseBrace.tests.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ $settings = @{
66
PSPlaceCloseBrace = @{
77
Enable = $true
88
NoEmptyLineBefore = $true
9+
IgnoreOneLineIf = $true
910
}
1011
}
1112
}
@@ -89,5 +90,13 @@ Get-Process * | % { "blah" }
8990
It "Should not find a violation" {
9091
$violations.Count | Should Be 0
9192
}
93+
94+
It "Should ignore violations for one line if statement" {
95+
$def = @'
96+
$x = if ($true) { "blah" } else { "blah blah" }
97+
'@
98+
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
99+
$violations.Count | Should Be 0
100+
}
92101
}
93-
}
102+
}

0 commit comments

Comments
 (0)