test: consolidate Go tests (#39962)

Consolidate all Go tests. Coverage is identical to before. Go tests are
around 5% faster while being 7% smaller. No non-test code is touched.
This commit is contained in:
silverwind authored and GitHub committed 2026-10-24 13:48:19 +00:00
1 parent ce7364e215
commit 8abda62312
388 files changed
+18410 -29561

No files matched your search

@@ -12,24 +12,16 @@ import (
)
func TestFileBackedBuffer(t *testing.T) {
cases := []struct {
MaxMemorySize int
Data string
}{
{5, "test"},
{5, "testtest"},
}
for _, c := range cases {
buf := New(c.MaxMemorySize, t.TempDir())
_, err := io.Copy(buf, strings.NewReader(c.Data))
for _, content := range []string{"test", "testtest"} {
buf := New(5, t.TempDir())
_, err := io.Copy(buf, strings.NewReader(content))
assert.NoError(t, err)
assert.EqualValues(t, len(c.Data), buf.Size())
assert.EqualValues(t, len(content), buf.Size())
data, err := io.ReadAll(buf)
assert.NoError(t, err)
assert.Equal(t, c.Data, string(data))
assert.Equal(t, content, string(data))
assert.NoError(t, buf.Close())
}