vexx32 / PSKoans

A simple, fun, and interactive way to learn the PowerShell language through Pester unit testing.
GNU General Public License v3.0
1.72k stars 174 forks source link

AutoCompleted "It"'s in AboutComparison.Koans.ps1 #212

Closed EVWorth closed 5 years ago

EVWorth commented 5 years ago

Describe "Koan Bug, Issue, or Help Request"

There are three sections that are auto-completing progress even though the progress is not completed. Once reaching AboutComparison, Running Measure-Karma displays 3/19 complete before beginning.

https://github.com/vexx32/PSKoans/blob/3070afd4200c997572ce5950bc91d44a1014d26f/PSKoans/Koans/Foundations/AboutComparison.Koans.ps1#L19-L26

https://github.com/vexx32/PSKoans/blob/3070afd4200c997572ce5950bc91d44a1014d26f/PSKoans/Koans/Foundations/AboutComparison.Koans.ps1#L169-L173

https://github.com/vexx32/PSKoans/blob/3070afd4200c997572ce5950bc91d44a1014d26f/PSKoans/Koans/Foundations/AboutComparison.Koans.ps1#L192-L197

all three of these show as completed/green when running .\AboutComparison.Koans.ps1

Context "The Problematic Assertions"

for instance, with: https://github.com/vexx32/PSKoans/blob/3070afd4200c997572ce5950bc91d44a1014d26f/PSKoans/Koans/Foundations/AboutComparison.Koans.ps1#L169-L173

If I remove the first $true, and replace it with __, the Koan shows the it statement failing.

Context "Your Attempts"

the following are the options and their success/failure for the 3 first "words" for "return $true if either input is $true'

$true, , : Pass $true, $true, $true : Pass __ , $true, $true : Fail $true, $true, $false : Fail

Context "Additional Information"

Pester Version: 4.8.1 PowerShell Version: 5.1.18362.145

vexx32 commented 5 years ago

Ah, gotcha. Okay, yeah, these need to be changed. The assertion __ | Should -BeTrue (or anything equivalent) will always pass. I think a lot of these could/should be fixed by replacing __ entries with $____ -- the variable doesn't exist so it will fail the test properly. 🙂

EVWorth commented 5 years ago

would it make sense to replace all instances of with $ and the same for the quoted __ in all Koans?

vexx32 commented 5 years ago

No, not in all instances. At a glance, it looks appropriate here because we're expecting the variable $true or $false to be input (therefore a blank variable $____ makes sense).

There are a lot more places we're expecting numbers, text, etc. -- the format of the blank should generally match the expected input. 🙂