Download PowerShell-master/test/powershell/engine/Basic/Attributes.Tests.ps1 from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/engine/Basic/Attributes.Tests.ps1
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/powershell/engine/Basic/Attributes.Tests.ps1
-
curl -L -o Attributes.Tests.ps1 https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/engine/Basic/Attributes.Tests.ps1
723 Bytes
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| Describe "Attribute tests" -Tags "CI" { | |
| BeforeEach { | |
| Remove-Item $testdrive/test.ps1 -Force -ErrorAction SilentlyContinue | |
| } | |
| It "<attribute> attribute returns argument error if empty" -TestCases @( | |
| @{Attribute="HelpMessage"}, | |
| @{Attribute="HelpMessageBaseName"}, | |
| @{Attribute="HelpMessageResourceId"} | |
| ) { | |
| param($attribute) | |
| $script = @" | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter($attribute="")] | |
| [String]`$Parameter1 | |
| ) | |
| Write-Output "Hello" | |
| "@ | |
| New-Item -Path $testdrive/test.ps1 -Value $script -ItemType File | |
| { & $testdrive/test.ps1 } | Should -Throw -ErrorId "Argument" | |
| } | |
| } | |