Skip to content

Commit c991c8e

Browse files
committed
TestPipelineDir: use a substitute for pwd on Windows
1 parent 79299d6 commit c991c8e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

internal/pipe/pipeline_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"io/ioutil"
1111
"os"
12+
"path/filepath"
1213
"runtime"
1314
"strconv"
1415
"strings"
@@ -184,10 +185,6 @@ func TestPipelineTwoCommandsPiping(t *testing.T) {
184185
}
185186

186187
func TestPipelineDir(t *testing.T) {
187-
if runtime.GOOS == "windows" {
188-
t.Skip("FIXME: test skipped on Windows: 'pwd' incompatibility")
189-
}
190-
191188
t.Parallel()
192189
ctx := context.Background()
193190

@@ -198,11 +195,16 @@ func TestPipelineDir(t *testing.T) {
198195
defer os.RemoveAll(dir)
199196

200197
p := pipe.New(pipe.WithDir(dir))
201-
p.Add(pipe.Command("pwd"))
198+
switch runtime.GOOS {
199+
case "windows":
200+
p.Add(pipe.Command("bash", "-c", "pwd -W"))
201+
default:
202+
p.Add(pipe.Command("pwd"))
203+
}
202204

203205
out, err := p.Output(ctx)
204206
if assert.NoError(t, err) {
205-
assert.Equal(t, dir, strings.TrimSuffix(string(out), "\n"))
207+
assert.Equal(t, filepath.Clean(dir), filepath.Clean(strings.TrimSuffix(string(out), "\n")))
206208
}
207209
}
208210

0 commit comments

Comments
 (0)