MCPcopy
hub / github.com/github/git-sizer / TestPipelineDir

Function TestPipelineDir

internal/pipe/pipeline_test.go:187–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

185}
186
187func TestPipelineDir(t *testing.T) {
188 t.Parallel()
189 ctx := context.Background()
190
191 wdir, err := os.Getwd()
192 require.NoError(t, err)
193 dir, err := ioutil.TempDir(wdir, "pipeline-test-")
194 require.NoError(t, err)
195 defer os.RemoveAll(dir)
196
197 p := pipe.New(pipe.WithDir(dir))
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 }
204
205 out, err := p.Output(ctx)
206 if assert.NoError(t, err) {
207 assert.Equal(t, filepath.Clean(dir), filepath.Clean(strings.TrimSuffix(string(out), "\n")))
208 }
209}
210
211func TestPipelineExit(t *testing.T) {
212 t.Parallel()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
WithDirFunction · 0.92
CommandFunction · 0.92
OutputMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected