diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-04-22 20:37:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-22 20:37:50 +0200 |
commit | 7b3220f1790e35ed1596540363599099c2821b9f (patch) | |
tree | e2881d61cb341218395e75e35344cb5835df98aa /utils/binary/read_test.go | |
parent | 6d4408addbaec52b861012688df0f09b79362e42 (diff) | |
parent | 262179b985108f0cbabc046b315e4feb3311a199 (diff) | |
download | go-git-7b3220f1790e35ed1596540363599099c2821b9f.tar.gz |
Merge pull request #1126 from saracen/index-performance-improvements
plumbing: format/index perf, buffered reads, reflection removal
Diffstat (limited to 'utils/binary/read_test.go')
-rw-r--r-- | utils/binary/read_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/binary/read_test.go b/utils/binary/read_test.go index 5674653..22867c2 100644 --- a/utils/binary/read_test.go +++ b/utils/binary/read_test.go @@ -1,6 +1,7 @@ package binary import ( + "bufio" "bytes" "encoding/binary" "testing" @@ -39,6 +40,15 @@ func (s *BinarySuite) TestReadUntil(c *C) { c.Assert(string(b), Equals, "foo") } +func (s *BinarySuite) TestReadUntilFromBufioReader(c *C) { + buf := bufio.NewReader(bytes.NewBuffer([]byte("foo bar"))) + + b, err := ReadUntilFromBufioReader(buf, ' ') + c.Assert(err, IsNil) + c.Assert(b, HasLen, 3) + c.Assert(string(b), Equals, "foo") +} + func (s *BinarySuite) TestReadVariableWidthInt(c *C) { buf := bytes.NewBuffer([]byte{129, 110}) |