tests: add TestFileHoles

Create a file with holes by writing to offset 0 (block #0) and
offset 4096 (block #1).

This test currently fails.
This commit is contained in:
Jakob Unterwurzacher 2015-10-04 10:38:58 +02:00
parent 40448db909
commit fa88741770

View File

@ -178,6 +178,23 @@ func TestAppend(t *testing.T) {
}
}
// Create a file with holes by writing to offset 0 (block #0) and
// offset 4096 (block #1).
func TestFileHoles(t *testing.T) {
fn := plainDir + "fileholes"
file, err := os.Create(fn)
if err != nil {
t.Errorf("file create failed")
}
foo := []byte("foo")
file.Write(foo)
file.WriteAt(foo, 4096)
_, err = ioutil.ReadFile(fn)
if err != nil {
t.Error(err)
}
}
func BenchmarkStreamWrite(t *testing.B) {
buf := make([]byte, 1024*1024)
t.SetBytes(int64(len(buf)))