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

Function TestFilterCanChainFilters

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

Source from the content-addressed store, hash-verified

383}
384
385func TestFilterCanChainFilters(t *testing.T) {
386 t.Parallel()
387 p := script.Echo("hello").Filter(func(r io.Reader, w io.Writer) error {
388 _, err := io.Copy(w, r)
389 return err
390 }).Filter(func(r io.Reader, w io.Writer) error {
391 _, err := io.Copy(w, r)
392 return err
393 })
394 want := "hello"
395 got, err := p.String()
396 if err != nil {
397 t.Fatal(err)
398 }
399 if want != got {
400 t.Error(cmp.Diff(want, got))
401 }
402}
403
404func TestFilterByCopyToDiscardGivesNoOutput(t *testing.T) {
405 t.Parallel()

Callers

nothing calls this directly

Calls 4

EchoFunction · 0.92
FilterMethod · 0.80
StringMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…