Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tst/functions/assert/String/Should-NotBeString.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ Describe "Should-NotBeString" {
}

It "Requires Expected" {
$err = { "abc" | Should-NotBeString } | Verify-Throw
$err.Exception | Verify-Type ([System.Management.Automation.ParameterBindingException])
# Don't invoke with Expected missing to test this: a missing mandatory parameter makes
# PowerShell prompt for it, which hangs an interactive test.ps1 run and the release build.
# Check the parameter metadata instead. See #2963.
(Get-Command Should-NotBeString).Parameters['Expected'].Attributes |
Where-Object { $_ -is [System.Management.Automation.ParameterAttribute] } |
ForEach-Object Mandatory |
Verify-True
}
}

9 changes: 7 additions & 2 deletions tst/functions/assert/Time/Should-BeFasterThan.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ Describe "Should-BeFasterThan" {
}

It "Requires Expected" {
$err = { [timespan]::FromMilliseconds(1) | Should-BeFasterThan } | Verify-Throw
$err.Exception | Verify-Type ([System.Management.Automation.ParameterBindingException])
# Don't invoke with Expected missing to test this: a missing mandatory parameter makes
# PowerShell prompt for it, which hangs an interactive test.ps1 run and the release build.
# Check the parameter metadata instead. See #2963.
(Get-Command Should-BeFasterThan).Parameters['Expected'].Attributes |
Where-Object { $_ -is [System.Management.Automation.ParameterAttribute] } |
ForEach-Object Mandatory |
Verify-True
}
}
9 changes: 7 additions & 2 deletions tst/functions/assert/Time/Should-BeSlowerThan.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ Describe "Should-BeSlowerThan" {
}

It "Requires Expected" {
$err = { [timespan]::FromMilliseconds(1) | Should-BeSlowerThan } | Verify-Throw
$err.Exception | Verify-Type ([System.Management.Automation.ParameterBindingException])
# Don't invoke with Expected missing to test this: a missing mandatory parameter makes
# PowerShell prompt for it, which hangs an interactive test.ps1 run and the release build.
# Check the parameter metadata instead. See #2963.
(Get-Command Should-BeSlowerThan).Parameters['Expected'].Attributes |
Where-Object { $_ -is [System.Management.Automation.ParameterAttribute] } |
ForEach-Object Mandatory |
Verify-True
}
}