mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Ensure HelpInfo.Category is consistently a string (#18254)
This commit is contained in:
@@ -86,7 +86,7 @@ namespace System.Management.Automation
|
||||
internal MamlClassHelpInfo Copy(HelpCategory newCategoryToUse)
|
||||
{
|
||||
MamlClassHelpInfo result = new MamlClassHelpInfo(_fullHelpObject.Copy(), newCategoryToUse);
|
||||
result.FullHelp.Properties["Category"].Value = newCategoryToUse;
|
||||
result.FullHelp.Properties["Category"].Value = newCategoryToUse.ToString();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -441,7 +441,7 @@ namespace System.Management.Automation
|
||||
internal MamlCommandHelpInfo Copy(HelpCategory newCategoryToUse)
|
||||
{
|
||||
MamlCommandHelpInfo result = new MamlCommandHelpInfo(_fullHelpObject.Copy(), newCategoryToUse);
|
||||
result.FullHelp.Properties["Category"].Value = newCategoryToUse;
|
||||
result.FullHelp.Properties["Category"].Value = newCategoryToUse.ToString();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,16 @@ function GetCurrentUserHelpRoot {
|
||||
return $userHelpRoot
|
||||
}
|
||||
|
||||
Describe 'Validate HelpInfo type' -Tags @('CI') {
|
||||
|
||||
It 'Category should be a string' {
|
||||
$help = Get-Help *
|
||||
$category = $help | ForEach-Object { $_.Category.GetType().FullName } | Select-Object -Unique
|
||||
$category.Count | Should -Be 1 -Because 'All help categories should be strings, >1 indicates a type mismatch'
|
||||
$category | Should -BeExactly 'System.String'
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Validate that <pshome>/<culture>/default.help.txt is present" -Tags @('CI') {
|
||||
|
||||
It "Get-Help returns information about the help system" {
|
||||
|
||||
Reference in New Issue
Block a user