skip a test on windows

This commit is contained in:
Songmu 2023-02-22 17:52:41 +09:00
parent 0079eff157
commit 8f7c89d3dd
2 changed files with 16 additions and 5 deletions

View file

@ -11,10 +11,6 @@ import (
"github.com/Songmu/gitconfig"
)
func samePath(lhs, rhs string) bool {
return lhs == rhs
}
func samePaths(lhs, rhs string) bool {
if runtime.GOOS != "windows" {
return lhs == rhs
@ -29,6 +25,7 @@ func TestDoRoot(t *testing.T) {
name string
setup func(t *testing.T)
expect, allExpect string
skipOnWin bool
}{{
name: "env",
setup: func(t *testing.T) {
@ -49,6 +46,17 @@ func TestDoRoot(t *testing.T) {
},
expect: "/path/to/ghqroot11\n",
allExpect: "/path/to/ghqroot11\n/path/to/ghqroot12\n",
/*
If your gitconfig contains a path to the start of slash, and you get it with `git config --type=path`,
the behavior on Windows is strange. Specifically, on Windows with GitHub Actions, a Git
installation path such as "C:/Program Files/Git/mingw64" is appended immediately before the path.
This has been addressed in the following issue, which seems to have been resolved in the v2.34.0
release.
https://github.com/git-for-windows/git/pull/3472
However, Git on GitHub Actions is v2.39.2 at the time of this comment, and this problem continues
to occur. I'm not sure, so I'll skip the test for now.
*/
skipOnWin: true,
}, {
name: "default home",
setup: func(t *testing.T) {
@ -71,6 +79,9 @@ func TestDoRoot(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
if tc.skipOnWin && runtime.GOOS == "windows" {
t.SkipNow()
}
defer func(orig []string) { _localRepositoryRoots = orig }(_localRepositoryRoots)
_localRepositoryRoots = nil
localRepoOnce = &sync.Once{}

View file

@ -30,7 +30,7 @@ func samePathSlice(lhss, rhss []string) bool {
sort.Strings(lhssAbs)
sort.Strings(rhssAbs)
for i := range lhssAbs {
if !samePath(lhssAbs[i], rhssAbs[i]) {
if lhssAbs[i] != rhssAbs[i] {
return false
}
}