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
2
9
$settings = @ {
3
10
IncludeRules = @ (" PSUseConsistentIndentation" )
4
11
Rules = @ {
@@ -143,5 +150,22 @@ select Name,Id |
143
150
$violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
144
151
$violations.Count | Should Be 3
145
152
}
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
+ }
146
170
}
147
171
}
You can’t perform that action at this time.
0 commit comments