Only search for functions in Constrained Language help tests (#9301)

Only search for functions in Constrained Language help tests

## PR Context

Searching for only functions is faster
This commit is contained in:
Travis Plunk 2019-04-08 11:01:33 -07:00 committed by GitHub
parent f5fc0535ac
commit 98b2e147c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,7 @@ try
Import-Module -Name $trustedModuleName1 -Force -ErrorAction Stop; Import-Module -Name $trustedModuleName1 -Force -ErrorAction Stop;
"@ "@
$command += @' $command += @'
$null = help NestedFn1 2> $null; $null = help -Name NestedFn1 -Category Function 2> $null;
$result = Get-Command NestedFn1 2> $null; $result = Get-Command NestedFn1 2> $null;
return ($result -ne $null) return ($result -ne $null)
'@ '@
@ -1003,7 +1003,7 @@ try
$scriptModuleName = "UntrustedModuleScriptBlockTest" $scriptModuleName = "UntrustedModuleScriptBlockTest"
$scriptModulePath = Join-Path $TestDrive ($scriptModuleName + ".psm1") $scriptModulePath = Join-Path $TestDrive ($scriptModuleName + ".psm1")
@' @'
function RunScriptBlock {{ function RunScriptBlock {{
$sb = (Get-Command -Name {0}).ScriptBlock $sb = (Get-Command -Name {0}).ScriptBlock
# ScriptBlock trusted function, TrustedFn, is dot sourced into current scope # ScriptBlock trusted function, TrustedFn, is dot sourced into current scope