diff --git a/test/powershell/Write-Debug.Tests.ps1 b/test/powershell/Write-Debug.Tests.ps1 index 194294a4e5..0878f9e1bd 100644 --- a/test/powershell/Write-Debug.Tests.ps1 +++ b/test/powershell/Write-Debug.Tests.ps1 @@ -13,7 +13,7 @@ ) $PSBoundParameters.GetEnumerator() | ForEach { - Write-Verbose $_ + Write-Verbose $_ } Write-Verbose "DebugPreference: $DebugPreference" diff --git a/test/powershell/Write-Host.Tests.ps1 b/test/powershell/Write-Host.Tests.ps1 new file mode 100644 index 0000000000..0c0cfbfa07 --- /dev/null +++ b/test/powershell/Write-Host.Tests.ps1 @@ -0,0 +1,26 @@ +Describe "Write-Host DRT Unit Tests" -Tags DRT{ + $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 { + param($Command, $returnValue) + + $tempFile = [io.path]::getTempFIleName() + $script = Join-Path $TestDrive -ChildPath writeHost.ps1 + + $Command > $script + + if($IsLinux) + { + powershell $script > $tempFile + } + else + { + powershell.exe $script > $tempFile + } + $content = Get-Content $tempFile + $content | Should Be $returnValue + } +} \ No newline at end of file