Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -4755,6 +4755,7 @@ internal static SessionStateAliasEntry[] BuiltInAliases
}

# Respect PAGER, use more on Windows, and use less on Linux
$moreArgs = ''
if (Test-Path env:PAGER) {
$pager,$moreArgs = $env:PAGER -split '\s+'
$moreCommand = (Get-Command -CommandType Application $pager | Select-Object -First 1).Definition
Expand All @@ -4768,7 +4769,9 @@ internal static SessionStateAliasEntry[] BuiltInAliases
foreach ($file in $paths) {
Get-Content $file | & $moreCommand $moreArgs
}
} else { $input | & $moreCommand $moreArgs }
} else {
$input | & $moreCommand $moreArgs
}
";

internal const string DefaultSetDriveFunctionText = "Set-Location $MyInvocation.MyCommand.Name";
Expand Down
16 changes: 15 additions & 1 deletion test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function GetCurrentUserHelpRoot {

Describe "Validate that <pshome>/<culture>/default.help.txt is present" -Tags @('CI') {

It "Get-Help returns information about the help system." {
It "Get-Help returns information about the help system" {

$help = Get-Help
$help.Name | Should -Be "default"
Expand All @@ -48,6 +48,20 @@ Describe "Validate that <pshome>/<culture>/default.help.txt is present" -Tags @(
}
}

Describe "Validate that the Help function can Run in strict mode" -Tags @('CI') {

It "Help doesn't fail when strict mode is on" {

$help = & {
# run in nested scope to keep strict mode from affecting other tests
Set-StrictMode -Version Latest
Help
}
# the help function renders the help content as text so just verify that there is content
$help | Should -Not -BeNullOrEmpty $true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the $true should not be needed.

describe 'test' {
   it 'failing test' {
       '' | should -not -BeNullOrEmpty
   }
   it 'passing test' {
       '' | should -BeNullOrEmpty
   }
 }

}
}

Describe "Validate that get-help works for CurrentUserScope" -Tags @('CI') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
Expand Down