You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It 'will expand variables that do not exist' {
<#
If a string contains a variable that has not been created,
PowerShell will still try to expand the value. A variable that
doesn't exist or has a null value will simply disappear when it
is expanded.
This could be the result of a typing mistake.
#>
$String = "PowerShell's home folder is: $SPHome"
'____' | Should -Be $String
}
Context "Your Attempts"
'PowerShell's home folder is:'
Context "Additional Information"
The ' in "PowerShell's" results in the rest of the script being invalidated. I can't figure out what answer will solve this part of the koan. I tried adding escape characters but it didn't work (I might not be doing it right).
The text was updated successfully, but these errors were encountered:
how-do-i-computer
changed the title
Seemingly correct answer in AboutStrings.Koans.ps1 invalidates the rest of the script
Seemingly correct answer in AboutStrings invalidates the rest of the script
Jul 18, 2020
Oh, you're absolutely right. The answer string needs to be given as "____" as well, so that the single quote doesn't break things.
For now, you can do that as well (start and end the answer string with ") or just escape the single quote with an additional one (like this: '... PowerShell''s ...') to prevent it terminating the string too early.
Sorry about that, we'll get that patched up! Thanks for reporting this! 😊 💖
Describe "Koan Bug, Issue, or Help Request"
AboutStringsKoans.ps1
Context "The Problematic Assertions"
It 'will expand variables that do not exist' {
<#
If a string contains a variable that has not been created,
PowerShell will still try to expand the value. A variable that
doesn't exist or has a null value will simply disappear when it
is expanded.
Context "Your Attempts"
'PowerShell's home folder is:'
Context "Additional Information"
The ' in "PowerShell's" results in the rest of the script being invalidated. I can't figure out what answer will solve this part of the koan. I tried adding escape characters but it didn't work (I might not be doing it right).
The text was updated successfully, but these errors were encountered: