Skip to content

Commit

Permalink
Add test for Windows shell behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
cortesi committed Aug 16, 2019
1 parent 466d7c8 commit 4b21bf3
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions shell/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package shell

import (
"fmt"
"os"
"runtime"
"strings"
"testing"
Expand Down Expand Up @@ -162,3 +163,36 @@ func TestShells(t *testing.T) {
}
}
}

func TestCaseInsensitivePath(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("skipping - only windows has case insensitive PATH")
}

oldpath := os.Getenv("PATH")
fixpath := func() {
os.Unsetenv("Path")
os.Setenv("PATH", oldpath)
}
defer fixpath()
os.Unsetenv("PATH")
os.Setenv("Path", fmt.Sprintf("%s%ctrigger-text", oldpath, os.PathListSeparator))

shellTesting = true

pathTest := cmdTest{
name: "path-test",
cmd: "echo $PATH",
logHas: "trigger-text",
}
sh := "modd"
t.Run(
"modd/path-capitalization",
func(t *testing.T) {
if _, err := CheckShell(sh); err != nil {
t.Skipf("skipping - %s", err)
}
testCmd(t, sh, pathTest)
},
)
}

0 comments on commit 4b21bf3

Please sign in to comment.