Closed nohwnd closed 6 years ago
How should the Assert-False behave to be most useful?
Assert-False
1) Should it be really strict and only pass when provided with a boolean $false? if ($actual -is [bool] -and $false -eq $actual) {throw}
$false
if ($actual -is [bool] -and $false -eq $actual) {throw}
2) Should it be more forgiving and pass when given falsey value ($false, 0, "", $null, @())? if ($actual) {throw}
$false, 0, "", $null, @()
if ($actual) {throw}
3) Should it fail for $null but pass for some other falsey values? if ($false -ne $actual) {throw}
$null
if ($false -ne $actual) {throw}
Probably combination of all is permissible, but community should share it's opinion before I overload this with switches. The current behavior is 2).
If if(!($actual)){} is how my code is testing for a false value then the Assert-False should as well
if(!($actual)){}
Okay keeping it as it is.
How should the
Assert-False
behave to be most useful?1) Should it be really strict and only pass when provided with a boolean
$false
?if ($actual -is [bool] -and $false -eq $actual) {throw}
2) Should it be more forgiving and pass when given falsey value (
$false, 0, "", $null, @()
)?if ($actual) {throw}
3) Should it fail for
$null
but pass for some other falsey values?if ($false -ne $actual) {throw}
Probably combination of all is permissible, but community should share it's opinion before I overload this with switches. The current behavior is 2).