Token calculation fix for Get-Help executed on ScriptBlock for comment help. (#8238)

This commit is contained in:
Hubert Bukowski
2018-11-20 11:11:17 -08:00
committed by Aditya Patwardhan
parent f27dfea065
commit a8627b83e5
2 changed files with 58 additions and 2 deletions
@@ -80,6 +80,57 @@ Describe 'get-help HelpFunc1' -Tags "Feature" {
# Useless
#
function helpFunc1 {}
Set-Item function:dynamicHelpFunc1 -Value {
# .SYNOPSIS
#
# A relatively useless function.
#
# .DESCRIPTION
#
# A description
#
# with indented text and a blank line.
#
# .NOTES
#
# This function is mostly harmless.
#
# .LINK
#
# http://blogs.msdn.com/powershell
#
# .LINK
#
# other commands
#
# .EXAMPLE
#
# If you need an example, you're hopeless.
#
# .INPUTS
#
# Anything you like.
#
# .OUTPUTS
#
# Nothing.
#
# .COMPONENT
#
# Something
#
# .ROLE
#
# CrazyUser
#
# .FUNCTIONALITY
#
# Useless
#
process { }
}
}
Context 'Get-Help helpFunc1' {
@@ -87,6 +138,11 @@ Describe 'get-help HelpFunc1' -Tags "Feature" {
TestHelpFunc1 $x
}
Context 'Get-Help dynamicHelpFunc1' {
$x = get-help dynamicHelpFunc1
TestHelpFunc1 $x
}
Context 'get-help helpFunc1 -component blah' {
$x = get-help helpFunc1 -component blah -ErrorAction SilentlyContinue -ErrorVariable e
TestHelpError $x $e 'HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand'