Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
bergmeister committed Aug 17, 2019
commit cc8bf1697502a101da6ecd824e2082232bdb22fb
18 changes: 18 additions & 0 deletions Tests/Rules/UseConsistentIndentation.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ function foo {
Invoke-Formatter -ScriptDefinition $idempotentScriptDefinition -Settings $settings | Should -Be $idempotentScriptDefinition
}

It "Should preserve script when using PipelineIndentation <PipelineIndentation> for multi-line pipeline due to backtick" -TestCases @(
@{ PipelineIndentation = 'IncreaseIndentationForFirstPipeline' }
@{ PipelineIndentation = 'IncreaseIndentationAfterEveryPipeline' }
@{ PipelineIndentation = 'NoIndentation' }
) {
param ($PipelineIndentation)
$idempotentScriptDefinition = @'
Describe 'describe' {
It 'it' {
{ 'To be,' -or `
-not 'to be' } | Should -Be 'the question'
}
}
'@
$settings.Rules.PSUseConsistentIndentation.PipelineIndentation = $PipelineIndentation
Invoke-Formatter -ScriptDefinition $idempotentScriptDefinition -Settings $settings | Should -Be $idempotentScriptDefinition
}

It "Should indent pipelines correctly using NoIndentation option" {
$def = @'
foo |
Expand Down