added test

This commit is contained in:
Tom Mombourquette 2019-11-20 19:17:36 -04:00
parent d9ef17a04d
commit b8247ce972
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package mem package mem
import ( import (
"io"
"io/ioutil" "io/ioutil"
"testing" "testing"
@ -27,6 +28,16 @@ func Test_File_Seek(t *testing.T) {
f, err = pkg.Open(":/wilco.band") f, err = pkg.Open(":/wilco.band")
r.NoError(err) r.NoError(err)
// seek to end of file before read
pos, err := f.Seek(0, io.SeekEnd)
r.NoError(err)
r.Equal(int64(len(data)), pos)
// reset seek
pos, err = f.Seek(0, 0)
r.NoError(err)
r.Equal(int64(0), pos)
b, err := ioutil.ReadAll(f) b, err := ioutil.ReadAll(f)
r.NoError(err) r.NoError(err)
r.Equal(data, b) r.Equal(data, b)