From 2dd01a9d311a4a45575160c29ee04e51e53f5175 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 29 Jun 2016 14:39:41 -0700 Subject: [PATCH] Fix Write-Host tests These were not testing the development build of PowerShell. --- .../Write-Host.Tests.ps1 | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 index 2395d91bf..ce59a43b1 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Host.Tests.ps1 @@ -1,22 +1,18 @@ -Describe "Write-Host DRT Unit Tests" -Tags DRT{ +Describe "Write-Host DRT Unit Tests" -Tags DRT { + + BeforeAll { + $powershell = Join-Path -Path $PsHome -ChildPath "powershell" + } + + $testData = @( @{ Name = 'NoNewline';Command = "Write-Host a,b -Separator ',' -ForegroundColor Yellow -BackgroundColor DarkBlue -NoNewline"; returnValue = "a,b" } @{ Name = 'Separator';Command = "Write-Host a,b,c -Separator '+'"; returnValue = "a+b+c" } ) - - It "write-Host works with '' switch" -TestCases $testData -Pending:$IsOSX { - param($Command, $returnValue) - If($IsLinux) - { - $content = powershell -noprofile -command $Command - } - - If ($IsWindows) - { - $content = powershell.exe -noprofile -command $Command - } + It "write-Host works with '' switch" -TestCases $testData -Pending:$IsOSX { + param($Command, $returnValue) - $content | Should Be $returnValue + & $powershell -noprofile $Command | Should Be $returnValue } -} \ No newline at end of file +}