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
You have not yet reached enlightenment.
The answers you seek...
Expected strings to be the same, but they were different.
Expected length: 82
Actual length: 78
Strings differ at index 0.
Expected: ' + Cate...'
But was: '+ Category...'
Context "The Problematic Assertions"
It 'can use the error stream (number 2)' {
# Redirecting errors can generally only be done from any scope above where the error is generated.& { Write-Error'The gasoline is in the water.' } 2>$FilePath$FileContent=Get-Content-Path $FilePath' Write-Error ''The gasoline is in the water.'' : The gasoline is in the water.'| Should -Be $FileContent[0]
"+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException"|
Should -Be $FileContent[4]
"+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException"|
Should -Be $FileContent[5]
}
Context "Your Attempts"
The last two lines were pre-filled, so I didn't even touch them.
Testing the redirect output to file myself, I get the following output:
❯ Get-Content -Path C:\Temp\test.txt
Write-Error 'The gasoline is in the water.' : The gasoline is in the water.
At line:1 char:1
+ & { Write-Error 'The gasoline is in the water.' } 2> C:\Temp\Test.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
the following works:
It 'can use the error stream (number 2)' {
# Redirecting errors can generally only be done from any scope above where the error is generated.& { Write-Error'The gasoline is in the water.' } 2>$FilePath$FileContent=Get-Content-Path $FilePath' Write-Error ''The gasoline is in the water.'' : The gasoline is in the water.'| Should -Be $FileContent[0]
' + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException'|
Should -Be $FileContent[4]
' + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException'|
Should -Be $FileContent[5]
}
Context "Additional Information"
I think it would be better/more consistent to do something like:
'+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException' |
Should -Be $FileContent[4].TrimStart()
'+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException' |
Should -Be $FileContent[5].TrimStart()
The text was updated successfully, but these errors were encountered:
Describe "Koan Bug, Issue, or Help Request"
Context "The Problematic Assertions"
Context "Your Attempts"
The last two lines were pre-filled, so I didn't even touch them.
Testing the redirect output to file myself, I get the following output:
the following works:
Context "Additional Information"
I think it would be better/more consistent to do something like:
The text was updated successfully, but these errors were encountered: