MCPcopy
hub / github.com/bitfield/script / TestExecSendsStderrOutputToPipeStderr

Function TestExecSendsStderrOutputToPipeStderr

script_test.go:354–367  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

352}
353
354func TestExecSendsStderrOutputToPipeStderr(t *testing.T) {
355 t.Parallel()
356 buf := new(bytes.Buffer)
357 out, err := script.NewPipe().WithStderr(buf).Exec("go").String()
358 if err == nil {
359 t.Fatal("want error when command returns a non-zero exit status")
360 }
361 if out != "" {
362 t.Fatalf("unexpected output: %q", out)
363 }
364 if !strings.Contains(buf.String(), "Usage") {
365 t.Errorf("want stderr output containing the word 'Usage', got %q", buf.String())
366 }
367}
368
369func TestFilterByCopyPassesInputThroughUnchanged(t *testing.T) {
370 t.Parallel()

Callers

nothing calls this directly

Calls 4

NewPipeFunction · 0.92
StringMethod · 0.80
ExecMethod · 0.80
WithStderrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…