aboutsummaryrefslogtreecommitdiffstats
path: root/utils/sync/bufio_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2022-11-07 16:55:53 +0100
committerGitHub <noreply@github.com>2022-11-07 16:55:53 +0100
commitf37bb587b6634435afb5069b2101cb4e0ff78d63 (patch)
tree9e6ace8591fff4e95f982304842f0bf8512bd612 /utils/sync/bufio_test.go
parent652bc83fe45c114440de41d7e0fecf3e4b9e517d (diff)
parenta2c309de872dc18053acb186b1ec125d1f723a90 (diff)
downloadgo-git-f37bb587b6634435afb5069b2101cb4e0ff78d63.tar.gz
Merge pull request #608 from pjbgf/optimise-zlib-reader
Optimise zlib reader and consolidate sync.Pools
Diffstat (limited to 'utils/sync/bufio_test.go')
-rw-r--r--utils/sync/bufio_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/sync/bufio_test.go b/utils/sync/bufio_test.go
new file mode 100644
index 0000000..e70f3d8
--- /dev/null
+++ b/utils/sync/bufio_test.go
@@ -0,0 +1,26 @@
+package sync
+
+import (
+ "io"
+ "strings"
+ "testing"
+)
+
+func TestGetAndPutBufioReader(t *testing.T) {
+ wanted := "someinput"
+ r := GetBufioReader(strings.NewReader(wanted))
+ if r == nil {
+ t.Error("nil was not expected")
+ }
+
+ got, err := r.ReadString(0)
+ if err != nil && err != io.EOF {
+ t.Errorf("unexpected error reading string: %v", err)
+ }
+
+ if wanted != got {
+ t.Errorf("wanted %q got %q", wanted, got)
+ }
+
+ PutBufioReader(r)
+}