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

Function TestHash_ReturnsErrorGivenReadErrorOnPipe

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

Source from the content-addressed store, hash-verified

2156}
2157
2158func TestHash_ReturnsErrorGivenReadErrorOnPipe(t *testing.T) {
2159 t.Parallel()
2160 brokenReader := iotest.ErrReader(errors.New("oh no"))
2161 _, err := script.NewPipe().WithReader(brokenReader).Hash(sha256.New())
2162 if err == nil {
2163 t.Fatal(nil)
2164 }
2165}
2166
2167func TestHashSums_OutputsEmptyStringForFileThatCannotBeHashed(t *testing.T) {
2168 got, err := script.Echo("file_does_not_exist.txt").HashSums(sha256.New()).String()

Callers

nothing calls this directly

Calls 3

NewPipeFunction · 0.92
HashMethod · 0.80
WithReaderMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…