File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1027,6 +1027,48 @@ $(
10271027'@
10281028 Invoke-Formatter - ScriptDefinition $idempotentScriptDefinition - Settings $settings | Should - Be $idempotentScriptDefinition
10291029 }
1030+
1031+ It " Should not double-indent attribute that opens a scriptblock: [ArgumentCompleter({" {
1032+ $def = @'
1033+ [ArgumentCompleter({
1034+ Param($commandName, $parameterName)
1035+ $validKeys = @('a', 'b')
1036+ $validKeys | Where-Object { $_ } | ForEach-Object { "$_=" }
1037+ })]
1038+ '@
1039+ $expected = @'
1040+ [ArgumentCompleter({
1041+ Param($commandName, $parameterName)
1042+ $validKeys = @('a', 'b')
1043+ $validKeys | Where-Object { $_ } | ForEach-Object { "$_=" }
1044+ })]
1045+ '@
1046+ Invoke-Formatter - ScriptDefinition $def - Settings $settings | Should - Be $expected
1047+ }
1048+
1049+ It " Should not double-indent attribute that opens a scriptblock inside a param block: [ValidateScript({" {
1050+ $def = @'
1051+ function Test-Function {
1052+ param(
1053+ [ValidateScript({
1054+ $_ -gt 0
1055+ })]
1056+ $Value
1057+ )
1058+ }
1059+ '@
1060+ $expected = @'
1061+ function Test-Function {
1062+ param(
1063+ [ValidateScript({
1064+ $_ -gt 0
1065+ })]
1066+ $Value
1067+ )
1068+ }
1069+ '@
1070+ Invoke-Formatter - ScriptDefinition $def - Settings $settings | Should - Be $expected
1071+ }
10301072 }
10311073
10321074 Context " When tabs instead of spaces are used for indentation" {
You can’t perform that action at this time.
0 commit comments