From 9ae922551c777b5c81c447bf39b284032b52f036 Mon Sep 17 00:00:00 2001 From: TingLiu6 Date: Thu, 2 Jun 2016 23:31:12 -0700 Subject: [PATCH] Fixed CR Issues of Write-Host and Write-Output --- test/powershell/Write-Host.Tests.ps1 | 11 +++-------- test/powershell/Write-Output.Tests.ps1 | 5 +++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/powershell/Write-Host.Tests.ps1 b/test/powershell/Write-Host.Tests.ps1 index 5df8ac767..2395d91bf 100644 --- a/test/powershell/Write-Host.Tests.ps1 +++ b/test/powershell/Write-Host.Tests.ps1 @@ -7,21 +7,16 @@ It "write-Host works with '' switch" -TestCases $testData -Pending:$IsOSX { param($Command, $returnValue) - $tempFile = [io.path]::getTempFIleName() - $script = Join-Path $TestDrive -ChildPath writeHost.ps1 - - $Command > $script - If($IsLinux) { - powershell $script > $tempFile + $content = powershell -noprofile -command $Command } If ($IsWindows) { - powershell.exe $script > $tempFile + $content = powershell.exe -noprofile -command $Command } - $content = Get-Content $tempFile + $content | Should Be $returnValue } } \ No newline at end of file diff --git a/test/powershell/Write-Output.Tests.ps1 b/test/powershell/Write-Output.Tests.ps1 index fc29185a9..ffc2df858 100644 --- a/test/powershell/Write-Output.Tests.ps1 +++ b/test/powershell/Write-Output.Tests.ps1 @@ -13,6 +13,11 @@ Describe "Write-Output DRT Unit Tests" -Tags DRT{ $results[3] | Should Be $objectWritten[3] $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" {