MCPcopy Create free account
hub / github.com/containers/image / TestNewDigestingReader

Function TestNewDigestingReader

copy/digesting_reader_test.go:13–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestNewDigestingReader(t *testing.T) {
14 // Only the failure cases, success is tested in TestDigestingReaderRead below.
15 source := bytes.NewReader([]byte("abc"))
16 for _, input := range []digest.Digest{
17 "abc", // Not algo:hexvalue
18 "crc32:", // Unknown algorithm, empty value
19 "crc32:012345678", // Unknown algorithm
20 "sha256:", // Empty value
21 "sha256:0", // Invalid hex value
22 "sha256:01", // Invalid length of hex value
23 } {
24 _, err := newDigestingReader(source, input)
25 assert.Error(t, err, input.String())
26 }
27}
28
29func TestDigestingReaderRead(t *testing.T) {
30 cases := []struct {

Callers

nothing calls this directly

Calls 3

newDigestingReaderFunction · 0.85
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…