-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
User defined DynamicKeyword token is not recognized appropriately after code formatting.
#Requires -Version 4.0
Set-StrictMode -Version Latest
#Reset Existing Dynamic Keywords
[Management.Automation.Language.DynamicKeyword]::Reset()
#Add Dynamic Keyword
$keyword = New-Object System.Management.Automation.Language.DynamicKeyword
$keyword.Keyword = "requires"
$keyword.BodyMode = [Management.Automation.Language.DynamicKeywordBodyMode]::ScriptBlock
$keyword.NameMode = [Management.Automation.Language.DynamicKeywordNameMode]::NoName
[System.Management.Automation.Language.DynamicKeyword]::AddKeyword($keyword)
function Test
{
param (
$aaa,
$bbb
)
$ccc = "ccc"
requires
{
1 | should be 1
1 | should be 2
}
}
function requires
{
param (
[Management.Automation.Language.DynamicKeyword] $KeywordData,
$Name,
[ScriptBlock] $Value,
$SourceMetaData,
$InstanceName
)
#$PSBoundParameters
$ErrorActionPreference = "Stop"
try
{
return & $Value #Execute ScriptBlock
}
catch
{
Write-Host ("Error Line: {0}" -f $vvv.InvocationInfo.Line.Trim())
}
}
TestReactions are currently unavailable