diff options
author | Nick Thomas <nick@gitlab.com> | 2017-03-27 12:30:40 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-03-27 20:09:40 +0100 |
commit | ce4ca45ab6ad1d2c2350e3fb3f91a00b000139cb (patch) | |
tree | 46f45b4b5b4d3de611776e372025edf8a6055370 /plumbing/object/commit_test.go | |
parent | cfbd64f09f0d068d593f3dc3beb4ea7e62719e34 (diff) | |
download | go-git-ce4ca45ab6ad1d2c2350e3fb3f91a00b000139cb.tar.gz |
plumbing: Use ReadBytes() rather than ReadSlice()
Diffstat (limited to 'plumbing/object/commit_test.go')
-rw-r--r-- | plumbing/object/commit_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go index d30e1c4..8b4ee2a 100644 --- a/plumbing/object/commit_test.go +++ b/plumbing/object/commit_test.go @@ -2,6 +2,7 @@ package object import ( "io" + "strings" "time" "github.com/src-d/go-git-fixtures" @@ -167,3 +168,19 @@ func (s *SuiteCommit) TestCommitIterNext(c *C) { c.Assert(err, Equals, io.EOF) c.Assert(commit, IsNil) } + +func (s *SuiteCommit) TestLongCommitMessageSerialization(c *C) { + encoded := &plumbing.MemoryObject{} + decoded := &Commit{} + commit := *s.Commit + + longMessage := "my message: message\n\n" + strings.Repeat("test", 4096) + "\nOK" + commit.Message = longMessage + + err := commit.Encode(encoded) + c.Assert(err, IsNil) + + err = decoded.Decode(encoded) + c.Assert(err, IsNil) + c.Assert(decoded.Message, Equals, longMessage) +} |