| 383 | } |
| 384 | |
| 385 | func 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 | |
| 404 | func TestFilterByCopyToDiscardGivesNoOutput(t *testing.T) { |
| 405 | t.Parallel() |