MCPcopy Create free account
hub / github.com/AdRoll/baker / TestGzReader

Function TestGzReader

input/inpututils/fastgzreader_test.go:36–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestGzReader(t *testing.T) {
37 data := getCorpus()
38
39 var buf bytes.Buffer
40 w := gzip.NewWriter(&buf)
41 w.Write(data)
42 w.Close()
43
44 r, err := newFastGzReader(&buf)
45 defer r.Close()
46 if err != nil {
47 t.Fatal(err)
48 }
49 data2, err := io.ReadAll(r)
50 if err != nil {
51 t.Fatal(err)
52 }
53
54 if !reflect.DeepEqual(data, data2) {
55 t.Error("data mismatch after decompression")
56 }
57}
58
59func TestGzReadErrorEmpty(t *testing.T) {
60 var empty bytes.Buffer

Callers

nothing calls this directly

Calls 5

getCorpusFunction · 0.85
newFastGzReaderFunction · 0.70
CloseMethod · 0.65
WriteMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected