diff options
author | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2017-05-10 16:47:15 +0200 |
---|---|---|
committer | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2017-05-23 11:05:14 +0200 |
commit | 2f293f4a5214ccba5bdf0b82ff8b62ed39144078 (patch) | |
tree | 8942869ff31dbf3aa950c1d3cddb3a0de8ca0aa3 /utils/binary/read_test.go | |
parent | 2ff77a8d93529cefdca922dbed89d4b1cd0ee8e5 (diff) | |
download | go-git-2f293f4a5214ccba5bdf0b82ff8b62ed39144078.tar.gz |
format/diff: unified diff encoder and public API
- Added Patch interface
- Added a Unified Diff encoder from Patches
- Added Change method to generate Patches
- Added Changes method to generate Patches
- Added Tree method to generate Patches
- Added Commit method to generate Patches
Diffstat (limited to 'utils/binary/read_test.go')
-rw-r--r-- | utils/binary/read_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/binary/read_test.go b/utils/binary/read_test.go index 59dbc30..5674653 100644 --- a/utils/binary/read_test.go +++ b/utils/binary/read_test.go @@ -85,3 +85,27 @@ func (s *BinarySuite) TestReadHash(c *C) { c.Assert(err, IsNil) c.Assert(hash.String(), Equals, expected.String()) } + +func (s *BinarySuite) TestIsBinary(c *C) { + buf := bytes.NewBuffer(nil) + buf.Write(bytes.Repeat([]byte{'A'}, sniffLen)) + buf.Write([]byte{0}) + ok, err := IsBinary(buf) + c.Assert(err, IsNil) + c.Assert(ok, Equals, false) + + buf.Reset() + + buf.Write(bytes.Repeat([]byte{'A'}, sniffLen-1)) + buf.Write([]byte{0}) + ok, err = IsBinary(buf) + c.Assert(err, IsNil) + c.Assert(ok, Equals, true) + + buf.Reset() + + buf.Write(bytes.Repeat([]byte{'A'}, 10)) + ok, err = IsBinary(buf) + c.Assert(err, IsNil) + c.Assert(ok, Equals, false) +} |