Skip these tests on platforms that don't have powershell installed

This commit is contained in:
Taliesin Sisson 2016-06-30 07:14:42 +01:00
parent 4721327bf6
commit 8c3239770d
1 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,13 @@ import (
func TestOutput(t *testing.T) {
var ps PowerShellCmd
powerShellPath, err := ps.getPowerShellPath()
if err != nil {
t.Skipf("powershell not installed: %s", err)
return
}
cmdOut, err := ps.Output("")
if err != nil {
t.Fatalf("should not have error: %s", err)
@ -40,6 +47,13 @@ func TestRunFile(t *testing.T) {
blockBuffer.WriteString(`param([string]$a, [string]$b, [int]$x, [int]$y) if (Test-Path variable:global:ProgressPreference){$ProgressPreference="SilentlyContinue"}; $n = $x + $y; Write-Output "$a $b $n";`)
var ps PowerShellCmd
powerShellPath, err := ps.getPowerShellPath()
if err != nil {
t.Skipf("powershell not installed: %s", err)
return
}
cmdOut, err := ps.Output(blockBuffer.String(), "a", "b", "5", "10")
if err != nil {