(t *testing.T)
| 1453 | } |
| 1454 | |
| 1455 | func TestStdoutSendsPipeContentsToConfiguredStandardOutput(t *testing.T) { |
| 1456 | t.Parallel() |
| 1457 | buf := new(bytes.Buffer) |
| 1458 | want := "hello world" |
| 1459 | p := script.File("testdata/hello.txt").WithStdout(buf) |
| 1460 | wrote, err := p.Stdout() |
| 1461 | if err != nil { |
| 1462 | t.Fatal(err) |
| 1463 | } |
| 1464 | if wrote != len(want) { |
| 1465 | t.Fatalf("want %d bytes written, got %d", len(want), wrote) |
| 1466 | } |
| 1467 | got := buf.String() |
| 1468 | if want != got { |
| 1469 | t.Fatalf("want %q, got %q", want, string(got)) |
| 1470 | } |
| 1471 | _, err = p.String() |
| 1472 | if err == nil { |
| 1473 | t.Error("input not closed after reading") |
| 1474 | } |
| 1475 | } |
| 1476 | |
| 1477 | func TestAppendFile_AppendsAllItsInputToSpecifiedFile(t *testing.T) { |
| 1478 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…