(t *testing.T)
| 402 | } |
| 403 | |
| 404 | func TestFilterByCopyToDiscardGivesNoOutput(t *testing.T) { |
| 405 | t.Parallel() |
| 406 | p := script.Echo("hello").Filter(func(r io.Reader, w io.Writer) error { |
| 407 | _, err := io.Copy(io.Discard, r) |
| 408 | return err |
| 409 | }) |
| 410 | want := "" |
| 411 | got, err := p.String() |
| 412 | if err != nil { |
| 413 | t.Fatal(err) |
| 414 | } |
| 415 | if want != got { |
| 416 | t.Error(cmp.Diff(want, got)) |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | func TestFilterReadsNoMoreThanRequested(t *testing.T) { |
| 421 | t.Parallel() |