File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 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+
7+ $indentationUnit = ' '
8+ $indentationSize = 4
29$settings = @ {
310 IncludeRules = @ (" PSUseConsistentIndentation" )
411 Rules = @ {
@@ -143,5 +150,22 @@ select Name,Id |
143150 $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
144151 $violations.Count | Should Be 3
145152 }
153+
154+ It " Should indent properly after line continuation (backtick) character" {
155+ $def = @'
156+ $x = "this " + `
157+ "Should be indented properly"
158+ '@
159+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
160+ $violations.Count | Should Be 1
161+ $params = @ {
162+ RawContent = $def
163+ DiagnosticRecord = $violations [0 ]
164+ CorrectionsCount = 1
165+ ViolationText = " `" Should be indented properly`" "
166+ CorrectionText = (New-Object - TypeName String - ArgumentList $indentationUnit , $indentationSize ) + " `" Should be indented properly`" "
167+ }
168+ Test-CorrectionExtentFromContent @params
169+ }
146170 }
147171}
You can’t perform that action at this time.
0 commit comments