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

Function TestTeeWritesDataToSuppliedWritersAsWellAsToPipe

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

Source from the content-addressed store, hash-verified

1203}
1204
1205func TestTeeWritesDataToSuppliedWritersAsWellAsToPipe(t *testing.T) {
1206 t.Parallel()
1207 buf1, buf2 := new(bytes.Buffer), new(bytes.Buffer)
1208 got, err := script.Echo("hello world").Tee(buf1, buf2).String()
1209 if err != nil {
1210 t.Fatal(err)
1211 }
1212 want := "hello world"
1213 if want != got {
1214 t.Errorf("want %q on pipe, got %q", want, got)
1215 }
1216 if want != buf1.String() {
1217 t.Errorf("want %q on writer 1, got %q", want, buf1.String())
1218 }
1219 if want != buf2.String() {
1220 t.Errorf("want %q on writer 2, got %q", want, buf2.String())
1221 }
1222}
1223
1224func TestExecErrorsWhenTheSpecifiedCommandDoesNotExist(t *testing.T) {
1225 t.Parallel()

Callers

nothing calls this directly

Calls 3

EchoFunction · 0.92
StringMethod · 0.80
TeeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…