mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
Fix rac.Writer with more than 510 leaf nodes
This commit is contained in:
1 parent
a1a5b40178
commit
5cfb01a69b
2 files changed
+44
-10
No files matched your search
@@ -319,3 +319,22 @@ func TestWriterMultiLevelIndex(t *testing.T) {
|
||||
t.Fatalf("\ngot:\n%s\nwant:\n%s", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriter1000Chunks(t *testing.T) {
|
||||
w := &Writer{
|
||||
Writer: ioutil.Discard,
|
||||
Codec: fakeCodec,
|
||||
}
|
||||
data := make([]byte, 1)
|
||||
res, _ := w.AddResource(data)
|
||||
for i := 0; i < 1000; i++ {
|
||||
if i == 2*255 {
|
||||
_ = w.AddChunk(1, data, res, 0)
|
||||
} else {
|
||||
_ = w.AddChunk(1, data, 0, 0)
|
||||
}
|
||||
}
|
||||
if err := w.Close(); err != nil {
|
||||
t.Fatalf("Close: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user