Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Accept pipeline input' properties in documentation of Invoke-Formatter #1833

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
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)') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the string format of this going to be consistent

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes and if not the test will fail anyway :-)

$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