diff options
author | Arran Walker <arran.walker@fiveturns.org> | 2019-04-22 17:10:29 +0000 |
---|---|---|
committer | Arran Walker <arran.walker@fiveturns.org> | 2019-04-22 17:10:29 +0000 |
commit | 262179b985108f0cbabc046b315e4feb3311a199 (patch) | |
tree | 7d2af0e060e3ed1e4550889214f01562895e258d /utils/binary/read_test.go | |
parent | 5598068360a39a61d97887522e474323d8f78f97 (diff) | |
download | go-git-262179b985108f0cbabc046b315e4feb3311a199.tar.gz |
utils: binary reader, add ReadUntilFromBufioReader()
Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
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}) |