vexx32 / PSKoans

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

Seemingly correct answer in AboutStrings does not work #406

Closed how-do-i-computer closed 4 years ago

how-do-i-computer commented 4 years ago

Describe "Koan Bug, Issue, or Help Request"

AboutStrings

Context "The Problematic Assertions"

It 'interprets all quotation marks literally' { $AllYourQuotes = @" All things that are not 'evaluated' are "recognised" as characters. "@ '____' | Should -Be $AllYourQuotes } }

Context "Your Attempts"

All things that are not 'evaluated' are "recognised" as characters.

Context "Additional Information"

Returns the following error:

At C:\Users\sinit\PSKoans\Introduction\AboutStrings.Koans.ps1:233 char:39

× It "Error occurred in test script 'C:\Users\sinit\PSKoans\Introduction\AboutStrings.Koans.ps1'" at , C:\Users\sinit\OneDrive\Documents\PowerShell\Modules\Pester\4.10.1\Pester.psm1: line 1111

I'm using VSCode 1.47.2 with PS [7.1.0-preview.5]

how-do-i-computer commented 4 years ago

I figured out the solution. When giving the answer:

All things that are not 'evaluated' are "recognised" as characters. should be All things that are not ''evaluated'' are "recognised" as characters.

vexx32 commented 4 years ago

No worries, I'll close this one for now then. I'll have to have a think on whether there's a better way to frame this koan so that error messages are more clearly shown, but I suspect doing so may be difficult at best, given we're dealing directly with PS's string tokenisation. :thinking: