Windows-powershell / PowerShell-master /test /powershell /Language /Scripting /SwitchParallel.Tests.ps1
Download PowerShell-master/test/powershell/Language/Scripting/SwitchParallel.Tests.ps1 from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Language/Scripting/SwitchParallel.Tests.ps1
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/powershell/Language/Scripting/SwitchParallel.Tests.ps1
-
curl -L -o SwitchParallel.Tests.ps1 https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Language/Scripting/SwitchParallel.Tests.ps1
1.48 kB
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| Describe 'Parallel switch syntax' -Tags 'CI' { | |
| Context 'Should be able to retrieve AST of parallel switch' { | |
| BeforeAll { | |
| $ast = [System.Management.Automation.Language.Parser]::ParseInput( | |
| 'switch -parallel ($foo) {1 {break}}', [ref] $null, [ref] $null) | |
| } | |
| It '$ast.EndBlock.Statements[0].Flags' { | |
| $ast.EndBlock.Statements[0].Flags | Should -BeExactly 'Parallel' | |
| } | |
| } | |
| Context 'Generates an error on invalid parameter' { | |
| BeforeAll { | |
| $errors = @() | |
| $ast = [System.Management.Automation.Language.Parser]::ParseInput( | |
| 'switch -bogus ($foo) {1 {break}}', [ref]$null, [ref]$errors) | |
| } | |
| It '$errors.Count' { | |
| $errors.Count | Should -Be 1 | |
| } | |
| It '$errors[0].ErrorId' { | |
| $errors[0].ErrorId | Should -BeExactly 'InvalidSwitchFlag' | |
| } | |
| } | |
| Context 'Generate an error on -parallel' { | |
| BeforeAll { | |
| $errors = @() | |
| $ast = [System.Management.Automation.Language.Parser]::ParseInput( | |
| 'switch -parallel ($foo) {1 {break}}', [ref]$null, [ref]$errors) | |
| } | |
| It '$errors.Count' { | |
| $errors.Count | Should -Be 1 | |
| } | |
| It '$errors[0].ErrorId' { | |
| $errors[0].ErrorId | Should -Be 'KeywordParameterReservedForFutureUse' | |
| } | |
| } | |
| } | |