Skip to content

Commit

Permalink
Correct pipeline acceptance docs for Invoke-Formatter.md (#1833)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergmeister authored Aug 30, 2022
1 parent 9d66016 commit fcead29
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions Tests/Engine/ModuleHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,25 @@ Describe 'Cmdlet parameter help' {
# To avoid calling Trim method on a null object.
$helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() }
$helpType | Should -Be $codeType -Because "help for $commandName has correct parameter type for $parameterName"

foreach($parameterAttribute in $parameter.Attributes) {
if ($parameterAttribute.ValueFromPipeline -eq $null) { continue }

$parameterHelpPipelineInput = if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') {
$true
}
else {
[System.Boolean]::Parse($parameterHelp.pipelineInput)
}

$parameterHelpPipelineInput | Should -Be $parameterAttribute.ValueFromPipelineByPropertyName `
-Because "Parameter $parameterName of command $CommandName and parameter set $($parameterAttribute.ParameterSetName) has correct ValueFromPipelineByPropertyName attribute"

if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') {
$parameterAttribute.ValueFromPipeline | Should -BeTrue `
-Because "Parameter $parameterName of command $CommandName and parameter set $($parameterAttribute.ParameterSetName) has correct ValueFromPipeline attribute"
}
}
}

foreach ($helpParam in $HelpParameterNames) {
Expand Down
6 changes: 3 additions & 3 deletions docs/Cmdlets/Invoke-Formatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept pipeline input: True
Accept wildcard characters: False
```
Expand All @@ -121,7 +121,7 @@ Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
Expand All @@ -137,7 +137,7 @@ Aliases:
Required: False
Position: 2
Default value: CodeFormatting
Accept pipeline input: False
Accept pipeline input: True
Accept wildcard characters: False
```

Expand Down

0 comments on commit fcead29

Please sign in to comment.