Skip to content

Commit

Permalink
Changed out-file parameter and updated Out-String koan (#198)
Browse files Browse the repository at this point in the history
* Changed out-file parameter and updated Out-String koan

* Added sensable key/value data

* Removed extra whitespace.
  • Loading branch information
Brandon Lundt authored and vexx32 committed Jun 11, 2019
1 parent 8db3533 commit 3320e2c
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions PSKoans/Koans/Cmdlets 2/AboutOutCmdlets.Koans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Context 'Out-* Cmdlets' {
It 'stores data in files' {
$Path = 'TestDrive:\File.txt'

'Stored knowledge is of little value until it is used.' | Out-File -Path $Path -NoNewline
'Stored knowledge is of little value until it is used.' | Out-File -FilePath $Path -NoNewline

'__' | Should -Be (Get-Content -Path $Path)
}
Expand Down Expand Up @@ -117,23 +117,20 @@ Context 'Out-* Cmdlets' {
#>

It 'creates string representations of data' {
$HomeFolder = Get-Item -Path $HOME

$HomeFolder | Should -Not -BeNullOrEmpty
$String = $HomeFolder | Out-String

# Fill in this here-string with the data you'd see in your console from calling Get-Item $HOME
#Create a hashtable that pipes into Out-String
$String = @{ } | Out-String

@"
Name Value
---- -----
Color Blue
Spectrum Ultraviolet
Directory: __
Mode LastWriteTime Length Name
---- ------------- ------ ----
______ __________________ ____
"@ | Should -Be $String
# Mind the indentations; here-strings have to terminate at the very beginning of a line.
}
}
}
}

0 comments on commit 3320e2c

Please sign in to comment.