mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add tests to language part 1 (#2086)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
function Run-TestOnWinFull
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param( [string]$name )
|
||||
|
||||
switch ($name)
|
||||
{
|
||||
"ActionPreference:ErrorAction=SuspendOnWorkflow" {
|
||||
workflow TestErrorActionSuspend { "Hello" }
|
||||
|
||||
$r = TestErrorActionSuspend -ErrorAction Suspend
|
||||
|
||||
$r | Should Be Hello
|
||||
break; }
|
||||
|
||||
"ForeachParallel:ASTOfParallelForeachOnWorkflow" {
|
||||
Import-Module PSWorkflow
|
||||
$errors = @()
|
||||
$ast = [System.Management.Automation.Language.Parser]::ParseInput(
|
||||
'workflow foo { foreach -parallel ($foo in $bar) {} }', [ref] $null, [ref] $errors)
|
||||
$errors.Count | Should Be 0
|
||||
$ast.EndBlock.Statements[0].Body.EndBlock.Statements[0].Flags | Should Be 'Parallel'
|
||||
break;
|
||||
}
|
||||
default {
|
||||
#do nothing
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user