extract_test.go: Simplified test code

This commit is contained in:
Scott 2020-01-15 13:22:41 +10:30
parent 35a413c80a
commit 8dbcf1c148
1 changed files with 2 additions and 11 deletions

View File

@ -45,26 +45,17 @@ func (r *testReader) Read(b []byte) (int, error) {
}
func TestExtract(t *testing.T) {
const wantPath = "testdata/expect.mjpeg"
got := &bytes.Buffer{}
e := NewExtractor()
r := &testReader{}
err := e.Extract(got, r, 0)
err := NewExtractor().Extract(got, &testReader{}, 0)
if err != nil {
t.Fatalf("could not extract: %v", err)
}
want, err := ioutil.ReadFile(wantPath)
want, err := ioutil.ReadFile("testdata/expect.mjpeg")
if err != nil {
t.Fatalf("could not read file for wanted MJPEG data: %v", err)
}
t.Logf("len(got): %d\n", len(got.Bytes()))
t.Logf("len(want): %d\n", len(want))
if !bytes.Equal(got.Bytes(), want) {
t.Error("did not get expected result")
}