Files
gitea/modules/util/filebuffer/file_backed_buffer_test.go
T
silverwind 8abda62312 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.
2026-10-24 13:48:19 +00:00

29 lines
583 B
Go

// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package filebuffer
import (
"io"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFileBackedBuffer(t *testing.T) {
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(content), buf.Size())
data, err := io.ReadAll(buf)
assert.NoError(t, err)
assert.Equal(t, content, string(data))
assert.NoError(t, buf.Close())
}
}