aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/fetch_pack_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/transport/fetch_pack_test.go')
-rw-r--r--plumbing/transport/fetch_pack_test.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/plumbing/transport/fetch_pack_test.go b/plumbing/transport/fetch_pack_test.go
index 7a7f86f..16112a9 100644
--- a/plumbing/transport/fetch_pack_test.go
+++ b/plumbing/transport/fetch_pack_test.go
@@ -5,6 +5,7 @@ import (
"encoding/base64"
"gopkg.in/src-d/go-git.v4/plumbing"
+ "gopkg.in/src-d/go-git.v4/plumbing/format/packp/advrefs"
. "gopkg.in/check.v1"
)
@@ -58,7 +59,7 @@ func (s *UploadPackSuite) TestUploadPackInfoEmpty(c *C) {
i := NewUploadPackInfo()
err := i.Decode(b)
- c.Assert(err, ErrorMatches, "permanent.*empty.*")
+ c.Assert(err, Equals, advrefs.ErrEmpty)
}
func (s *UploadPackSuite) TestUploadPackEncode(c *C) {
@@ -94,3 +95,25 @@ func (s *UploadPackSuite) TestUploadPackRequest(c *C) {
"0009done\n",
)
}
+
+func (s *UploadPackSuite) TestUploadPackRequest_IsEmpty(c *C) {
+ r := &UploadPackRequest{}
+ r.Want(plumbing.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"))
+ r.Want(plumbing.NewHash("2b41ef280fdb67a9b250678686a0c3e03b0a9989"))
+ r.Have(plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))
+
+ c.Assert(r.IsEmpty(), Equals, false)
+
+ r = &UploadPackRequest{}
+ r.Want(plumbing.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"))
+ r.Want(plumbing.NewHash("2b41ef280fdb67a9b250678686a0c3e03b0a9989"))
+ r.Have(plumbing.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"))
+
+ c.Assert(r.IsEmpty(), Equals, false)
+
+ r = &UploadPackRequest{}
+ r.Want(plumbing.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"))
+ r.Have(plumbing.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"))
+
+ c.Assert(r.IsEmpty(), Equals, true)
+}