Commit a1cb9353 authored by gwenn's avatar gwenn

Fix BlobReadWriter.Reopen method.

parent a09c1c19
......@@ -134,3 +134,11 @@ func (r *BlobReader) Reopen(rowid int64) error {
r.ReadOffset = 0
return nil
}
func (w *BlobReadWriter) Reopen(rowid int64) error {
if err := w.BlobReader.Reopen(rowid); err != nil {
return err
}
w.WriteOffset = 0
return nil
}
......@@ -37,10 +37,15 @@ func TestBlob(t *testing.T) {
defer br.Close()
size, err := br.Size()
checkNoError(t, err, "blob size error: %s")
content = make([]byte, size)
n, err = br.Read(content)
n, err = br.Read(content[:5])
checkNoError(t, err, "blob read error: %s")
assertEquals(t, "expected %d bytes but got %d", 5, n)
n, err = br.Read(content[5:])
checkNoError(t, err, "blob read error: %s")
assertEquals(t, "expected %d bytes but got %d", 10, n)
assertEquals(t, "expected %d bytes but got %d", 5, n)
//fmt.Printf("%#v\n", content)
br.Close()
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment