Skip to content

Commit

Permalink
Use zio.Copy instead of manual loop
Browse files Browse the repository at this point in the history
Co-authored-by: Noah Treuhaft <[email protected]>
  • Loading branch information
jamii and nwt authored Nov 4, 2023
1 parent 82786cf commit cdce672
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions vng/vng_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,10 @@ func roundtrip(t *testing.T, valuesIn []zed.Value, writerOpts vngio.WriterOpts)
require.NoError(t, err)

// Read
fileOut := bytes.NewReader(buf.Bytes())
context := zed.NewContext()
reader, err := vngio.NewReader(context, fileOut)
reader, err := vngio.NewReader(zed.NewContext(), bytes.NewReader(buf.Bytes()))
require.NoError(t, err)
valuesOut := make([]zed.Value, 0, len(valuesIn))
for {
value, err := reader.Read()
require.NoError(t, err)
if value == nil {
break
}
valuesOut = append(valuesOut, *(value.Copy()))
}
var a zbuf.Array
require.NoError(t, zio.Copy(&a, reader))

// Compare
t.Logf("comparing: len(in)=%v vs len(out)=%v", len(valuesIn), len(valuesOut))

Check failure on line 100 in vng/vng_test.go

View workflow job for this annotation

GitHub Actions / test-windows

undefined: valuesOut
Expand Down

0 comments on commit cdce672

Please sign in to comment.