Skip to content

Commit 95a3be4

Browse files
author
Kapil Borle
committed
Add correction tests to new line after close brace
1 parent c0e8c43 commit 95a3be4

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Tests/Rules/PlaceCloseBrace.tests.ps1

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
Import-Module PSScriptAnalyzer
1+
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2+
$testRootDirectory = Split-Path -Parent $directory
3+
4+
Import-Module PSScriptAnalyzer
5+
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
6+
27
$ruleConfiguration = @{
38
Enable = $true
49
NoEmptyLineBefore = $true
@@ -132,6 +137,23 @@ if (Test-Path "blah") {
132137

133138
It "Should find two violations" {
134139
$violations.Count | Should Be 2
140+
$params = @{
141+
RawContent = $def
142+
DiagnosticRecord = $violations[0]
143+
CorrectionsCount = 1
144+
ViolationText = '}'
145+
CorrectionText = '}' + [System.Environment]::NewLine
146+
}
147+
Test-CorrectionExtentFromContent @params
148+
149+
$params = @{
150+
RawContent = $def
151+
DiagnosticRecord = $violations[1]
152+
CorrectionsCount = 1
153+
ViolationText = '}'
154+
CorrectionText = '}' + [System.Environment]::NewLine
155+
}
156+
Test-CorrectionExtentFromContent @params
135157
}
136158
}
137159
}

0 commit comments

Comments
 (0)