Adding upstream version 0.28.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
88f1d47ab6
commit
e28c88ef14
933 changed files with 194711 additions and 0 deletions
28
tools/router/rereadable_read_closer_test.go
Normal file
28
tools/router/rereadable_read_closer_test.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package router_test
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/tools/router"
|
||||
)
|
||||
|
||||
func TestRereadableReadCloser(t *testing.T) {
|
||||
content := "test"
|
||||
|
||||
rereadable := &router.RereadableReadCloser{
|
||||
ReadCloser: io.NopCloser(strings.NewReader(content)),
|
||||
}
|
||||
|
||||
// read multiple times
|
||||
for i := 0; i < 3; i++ {
|
||||
result, err := io.ReadAll(rereadable)
|
||||
if err != nil {
|
||||
t.Fatalf("[read:%d] %v", i, err)
|
||||
}
|
||||
if str := string(result); str != content {
|
||||
t.Fatalf("[read:%d] Expected %q, got %q", i, content, result)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue