mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
- Fix invalid value error message on some properties of ParameterAttribute to point to the specific properties. - Avoid wrapping argument exception into not a useful 'requires' exception.
25 lines
667 B
PowerShell
25 lines
667 B
PowerShell
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 } | ShouldBeErrorId "Argument"
|
|
}
|
|
}
|