File size: 955 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Run-TestOnWinFull
{
    [CmdletBinding()]
    param( [string]$name )

    switch ($name)
    {
        "ActionPreference:ErrorAction=SuspendOnWorkflow" {
            workflow TestErrorActionSuspend { "Hello" }

            $r = TestErrorActionSuspend -ErrorAction Suspend

            $r | Should -BeExactly '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 -BeExactly 'Parallel'
            break;
            }
        default {
            #do nothing
        }

    }
}