Fixed CR Issues of Write-Host and Write-Output

This commit is contained in:
TingLiu6 2016-06-02 23:31:12 -07:00
parent 0fa73fb375
commit 9ae922551c
2 changed files with 8 additions and 8 deletions

View file

@ -7,21 +7,16 @@
It "write-Host works with '<Name>' switch" -TestCases $testData -Pending:$IsOSX { It "write-Host works with '<Name>' switch" -TestCases $testData -Pending:$IsOSX {
param($Command, $returnValue) param($Command, $returnValue)
$tempFile = [io.path]::getTempFIleName()
$script = Join-Path $TestDrive -ChildPath writeHost.ps1
$Command > $script
If($IsLinux) If($IsLinux)
{ {
powershell $script > $tempFile $content = powershell -noprofile -command $Command
} }
If ($IsWindows) If ($IsWindows)
{ {
powershell.exe $script > $tempFile $content = powershell.exe -noprofile -command $Command
} }
$content = Get-Content $tempFile
$content | Should Be $returnValue $content | Should Be $returnValue
} }
} }

View file

@ -13,6 +13,11 @@ Describe "Write-Output DRT Unit Tests" -Tags DRT{
$results[3] | Should Be $objectWritten[3] $results[3] | Should Be $objectWritten[3]
$results[3] -is [System.String] | Should Be $true $results[3] -is [System.String] | Should Be $true
} }
It "Works with NoEnumerate switch" {
$objectWritten = 1, 2.2, @("John", "Smith", 10), "abc"
Write-Output $objectWritten -NoEnumerate 6>&1 | Should be '1 2.2 System.Object[] abc'
}
} }
Describe "Write-Output" { Describe "Write-Output" {