From 98b2e147c1cb50775e4875dde01fac18f1ca750c Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 8 Apr 2019 11:01:33 -0700 Subject: [PATCH] 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 --- .../ConstrainedLanguageRestriction.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 index a3bc16494d..b208197a73 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/ConstrainedLanguageRestriction.Tests.ps1 @@ -79,7 +79,7 @@ try Import-Module -Name $trustedModuleName1 -Force -ErrorAction Stop; "@ $command += @' - $null = help NestedFn1 2> $null; + $null = help -Name NestedFn1 -Category Function 2> $null; $result = Get-Command NestedFn1 2> $null; return ($result -ne $null) '@ @@ -1003,7 +1003,7 @@ try $scriptModuleName = "UntrustedModuleScriptBlockTest" $scriptModulePath = Join-Path $TestDrive ($scriptModuleName + ".psm1") @' - function RunScriptBlock {{ + function RunScriptBlock {{ $sb = (Get-Command -Name {0}).ScriptBlock # ScriptBlock trusted function, TrustedFn, is dot sourced into current scope