Skip to content

Commit

Permalink
Fix test for strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fflaten committed Jul 31, 2024
1 parent b4d2df0 commit c13b623
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions tst/functions/Add-ShouldOperator.ts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,10 @@ i -PassThru:$PassThru {
$succeeded = 'A' -eq $ActualValue
if ($Negate) { $succeeded = -not $succeeded }

if (-not $succeeded) {
if ($Negate) {
$failureMessage = "Expected anything but 'A', but got '$ActualValue'."
}
else {
$failureMessage = "Expected 'A', but got '$ActualValue'."
}
# Default failure message. Not used by Should unless succeeded is $false
$failureMessage = "Expected 'A', but got '$ActualValue'."
if (-not $succeeded -and $Negate) {
$failureMessage = "Expected anything but 'A', but got '$ActualValue'."
}

return [pscustomobject]@{
Expand Down Expand Up @@ -114,15 +111,13 @@ i -PassThru:$PassThru {
$succeeded = 'A' -eq $ActualValue
if ($Negate) { $succeeded = -not $succeeded }

if (-not $succeeded) {
if ($Negate) {
$failureMessage = "Expected anything but 'A', but got '$ActualValue'."
}
else {
$failureMessage = "Expected 'A', but got '$ActualValue'."
}
# Default failure message. Not used by Should unless succeeded is $false
$failureMessage = "Expected 'A', but got '$ActualValue'."
if (-not $succeeded -and $Negate) {
$failureMessage = "Expected anything but 'A', but got '$ActualValue'."
}


return [pscustomobject]@{
Succeeded = $succeeded
FailureMessage = $failureMessage
Expand Down

0 comments on commit c13b623

Please sign in to comment.