mirror of https://bitbucket.org/ausocean/av.git
extract_test.go: Simplified test code
This commit is contained in:
parent
35a413c80a
commit
8dbcf1c148
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue