Skip to content

Commit 053f141

Browse files
author
Kapil Borle
committed
Add test to verify correction for negative whitespace
1 parent 7d4c541 commit 053f141

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Tests/Rules/AlignAssignmentStatement.tests.ps1

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ $settings = @{
1919

2020
Describe "AlignAssignmentStatement" {
2121
Context "Hashtable" {
22-
It "Should align assignment statements in a hashtable" {
22+
It "Should align assignment statements in a hashtable when need to add whitespace" {
2323
$def = @'
2424
$hashtable = @{
2525
property1 = "value"
2626
anotherProperty = "another value"
2727
}
2828
'@
2929

30-
# Expected output should be the following
30+
# Expected output after correction should be the following
3131
# $hashtable = @{
3232
# property1 = "value"
3333
# anotherProperty = "another value"
@@ -37,5 +37,24 @@ $hashtable = @{
3737
$violations.Count | Should Be 1
3838
Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
3939
}
40-
}
40+
41+
It "Should align assignment statements in a hashtable when need to remove whitespace" {
42+
$def = @'
43+
$hashtable = @{
44+
property1 = "value"
45+
anotherProperty = "another value"
46+
}
47+
'@
48+
49+
# Expected output should be the following
50+
# $hashtable = @{
51+
# property1 = "value"
52+
# anotherProperty = "another value"
53+
# }
54+
55+
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings
56+
$violations.Count | Should Be 1
57+
Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
58+
}
59+
}
4160
}

0 commit comments

Comments
 (0)