aboutsummaryrefslogtreecommitdiffstats
path: root/options_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-05-05 11:34:50 +0200
committerGitHub <noreply@github.com>2017-05-05 11:34:50 +0200
commitced875aec7bef9113e1c37b1b811a59e17dbd138 (patch)
tree3cf652b8cfa94e011d4d7b5addfd13945870cda8 /options_test.go
parente80cdbabb92a1ec35ffad536f52d3ff04b548fd1 (diff)
parent3713157d189a109bdccdb055200defb17297b6de (diff)
downloadgo-git-ced875aec7bef9113e1c37b1b811a59e17dbd138.tar.gz
Merge pull request #375 from mcuadros/commit
worktree: Commit method implementation
Diffstat (limited to 'options_test.go')
-rw-r--r--options_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/options_test.go b/options_test.go
new file mode 100644
index 0000000..5274113
--- /dev/null
+++ b/options_test.go
@@ -0,0 +1,35 @@
+package git
+
+import (
+ . "gopkg.in/check.v1"
+ "gopkg.in/src-d/go-git.v4/plumbing/object"
+)
+
+type OptionsSuite struct {
+ BaseSuite
+}
+
+var _ = Suite(&OptionsSuite{})
+
+func (s *OptionsSuite) TestCommitOptionsParentsFromHEAD(c *C) {
+ o := CommitOptions{Author: &object.Signature{}}
+ err := o.Validate(s.Repository)
+ c.Assert(err, IsNil)
+ c.Assert(o.Parents, HasLen, 1)
+}
+
+func (s *OptionsSuite) TestCommitOptionsMissingAuthor(c *C) {
+ o := CommitOptions{}
+ err := o.Validate(s.Repository)
+ c.Assert(err, Equals, ErrMissingAuthor)
+}
+
+func (s *OptionsSuite) TestCommitOptionsCommitter(c *C) {
+ sig := &object.Signature{}
+
+ o := CommitOptions{Author: sig}
+ err := o.Validate(s.Repository)
+ c.Assert(err, IsNil)
+
+ c.Assert(o.Committer, Equals, o.Author)
+}