Closed Alektorophobia closed 5 years ago
Aha, that's a fun one.
🤔 I guess the best thing I can do is to make Get-Blank
return a custom type that always results in $false
when compared with anything. Pretty sure this is relatively doable, something like...
class Blank {
[string] ToString() {
return "__"
}
[bool] op_Equals([object] $other) {
return $false
}
}
Probably needs some tests of some sort in the proper implementation, but that's a start if anyone wants to PR that before I get to it. 😄
Describe "Koan Bug, Issue, or Help Request"
I noticed that the last test 'does not throw exceptions with invalid indexes' in the Foundations\AboutArrays.Koans.ps1 file passes without any user modifications.
Context "The Problematic Assertions"
https://github.com/vexx32/PSKoans/blob/622f2739bc4d70596ffe522876dc1735d7d148e3/PSKoans/Koans/Foundations/AboutArrays.Koans.ps1#L94-L103
Both sides of the Pipeline are $null. The left side has the alias named __, and that calls the function Get-Blank that returns $null. On the right side the Should -Be values are outside of the range of the array, and that also returns $null.
Context "Your Attempts"
I had attempted to change the __ to 0, which now fails and the following is displayed when running
Measure-Karma
.Context "Additional Information"
I'm running the following versions: PSversion: 5.1.17763.134 pskoans: 0.42.2 pester: 4.6.0