aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-11-20 01:59:18 +0100
committerGitHub <noreply@github.com>2017-11-20 01:59:18 +0100
commit4cbf210eb44ae648545e84da2414e3215a3399a1 (patch)
treec22984dc43e5c5bb317efa35d523f83d6db7a323 /plumbing/object/commit_test.go
parent65b4be36594ca91d3be49f9f6e7d8c8d92d2e42d (diff)
parente09fa242c1f97547527fa0cb9f6288f9ae17479e (diff)
downloadgo-git-4cbf210eb44ae648545e84da2414e3215a3399a1.tar.gz
Merge pull request #534 from josharian/firstparent
plumbing: object, commit.Parent() method
Diffstat (limited to 'plumbing/object/commit_test.go')
-rw-r--r--plumbing/object/commit_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go
index e84160b..f0792e6 100644
--- a/plumbing/object/commit_test.go
+++ b/plumbing/object/commit_test.go
@@ -67,6 +67,18 @@ func (s *SuiteCommit) TestParents(c *C) {
i.Close()
}
+func (s *SuiteCommit) TestParent(c *C) {
+ commit, err := s.Commit.Parent(1)
+ c.Assert(err, IsNil)
+ c.Assert(commit.Hash.String(), Equals, "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69")
+}
+
+func (s *SuiteCommit) TestParentNotFound(c *C) {
+ commit, err := s.Commit.Parent(42)
+ c.Assert(err, Equals, ErrParentNotFound)
+ c.Assert(commit, IsNil)
+}
+
func (s *SuiteCommit) TestPatch(c *C) {
from := s.commit(c, plumbing.NewHash("918c48b83bd081e863dbe1b80f8998f058cd8294"))
to := s.commit(c, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))