aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/encoder_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/format/packfile/encoder_test.go')
-rw-r--r--plumbing/format/packfile/encoder_test.go76
1 files changed, 0 insertions, 76 deletions
diff --git a/plumbing/format/packfile/encoder_test.go b/plumbing/format/packfile/encoder_test.go
index 551d7ec..b5b0c42 100644
--- a/plumbing/format/packfile/encoder_test.go
+++ b/plumbing/format/packfile/encoder_test.go
@@ -2,11 +2,9 @@ package packfile
import (
"bytes"
- "io"
"github.com/src-d/go-git-fixtures"
"gopkg.in/src-d/go-git.v4/plumbing"
- "gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/storage/memory"
. "gopkg.in/check.v1"
@@ -88,80 +86,6 @@ func (s *EncoderSuite) TestHashNotFound(c *C) {
c.Assert(err, Equals, plumbing.ErrObjectNotFound)
}
-func (s *EncoderSuite) TestDecodeEncodeDecode(c *C) {
- fixtures.Basic().ByTag("packfile").Test(c, func(f *fixtures.Fixture) {
- pf := f.Packfile()
- ph := f.PackfileHash
- storage := memory.NewStorage()
- s.testDecodeEncodeDecode(c, pf, ph, storage)
- })
-}
-
-func (s *EncoderSuite) testDecodeEncodeDecode(c *C,
- pf io.ReadCloser,
- ph plumbing.Hash,
- storage storer.Storer) {
-
- defer func() {
- c.Assert(pf.Close(), IsNil)
- }()
-
- scanner := NewScanner(pf)
-
- d, err := NewDecoder(scanner, storage)
- c.Assert(err, IsNil)
-
- ch, err := d.Decode()
- c.Assert(err, IsNil)
- c.Assert(ch, Equals, ph)
-
- objIter, err := storage.IterEncodedObjects(plumbing.AnyObject)
- c.Assert(err, IsNil)
-
- expectedObjects := map[plumbing.Hash]bool{}
- var hashes []plumbing.Hash
- err = objIter.ForEach(func(o plumbing.EncodedObject) error {
- expectedObjects[o.Hash()] = true
- hashes = append(hashes, o.Hash())
- return err
-
- })
- c.Assert(err, IsNil)
-
- enc := NewEncoder(s.buf, storage, false)
- _, err = enc.Encode(hashes)
- c.Assert(err, IsNil)
-
- scanner = NewScanner(s.buf)
- storage = memory.NewStorage()
- d, err = NewDecoder(scanner, storage)
- c.Assert(err, IsNil)
- _, err = d.Decode()
- c.Assert(err, IsNil)
-
- objIter, err = storage.IterEncodedObjects(plumbing.AnyObject)
- c.Assert(err, IsNil)
- obtainedObjects := map[plumbing.Hash]bool{}
- err = objIter.ForEach(func(o plumbing.EncodedObject) error {
- obtainedObjects[o.Hash()] = true
- return nil
- })
- c.Assert(err, IsNil)
- c.Assert(obtainedObjects, DeepEquals, expectedObjects)
-
- for h := range obtainedObjects {
- if !expectedObjects[h] {
- c.Errorf("obtained unexpected object: %s", h)
- }
- }
-
- for h := range expectedObjects {
- if !obtainedObjects[h] {
- c.Errorf("missing object: %s", h)
- }
- }
-}
-
func (s *EncoderSuite) TestDecodeEncodeWithDeltaDecodeREF(c *C) {
s.enc = NewEncoder(s.buf, s.store, true)
s.simpleDeltaTest(c)