aboutsummaryrefslogtreecommitdiffstats
path: root/formats/idxfile/encoder_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-11-08 23:46:38 +0100
committerGitHub <noreply@github.com>2016-11-08 23:46:38 +0100
commitac095bb12c4d29722b60ba9f20590fa7cfa6bc7d (patch)
tree223f36f336ba3414b1e45cac8af6c4744a5d7ef6 /formats/idxfile/encoder_test.go
parente523701393598f4fa241dd407af9ff8925507a1a (diff)
downloadgo-git-ac095bb12c4d29722b60ba9f20590fa7cfa6bc7d.tar.gz
new plumbing package (#118)
* plumbing: now core was renamed to core, and formats and clients moved inside
Diffstat (limited to 'formats/idxfile/encoder_test.go')
-rw-r--r--formats/idxfile/encoder_test.go48
1 files changed, 0 insertions, 48 deletions
diff --git a/formats/idxfile/encoder_test.go b/formats/idxfile/encoder_test.go
deleted file mode 100644
index d9d83eb..0000000
--- a/formats/idxfile/encoder_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package idxfile
-
-import (
- "bytes"
- "io/ioutil"
-
- . "gopkg.in/check.v1"
- "gopkg.in/src-d/go-git.v4/core"
- "gopkg.in/src-d/go-git.v4/fixtures"
-)
-
-func (s *IdxfileSuite) TestEncode(c *C) {
- expected := &Idxfile{}
- expected.Add(core.NewHash("4bfc730165c370df4a012afbb45ba3f9c332c0d4"), 82, 82)
- expected.Add(core.NewHash("8fa2238efdae08d83c12ee176fae65ff7c99af46"), 42, 42)
-
- buf := bytes.NewBuffer(nil)
- e := NewEncoder(buf)
- _, err := e.Encode(expected)
- c.Assert(err, IsNil)
-
- idx := &Idxfile{}
- d := NewDecoder(buf)
- err = d.Decode(idx)
- c.Assert(err, IsNil)
-
- c.Assert(idx.Entries, DeepEquals, expected.Entries)
-}
-
-func (s *IdxfileSuite) TestDecodeEncode(c *C) {
- fixtures.ByTag("packfile").Test(c, func(f *fixtures.Fixture) {
- expected, err := ioutil.ReadAll(f.Idx())
- c.Assert(err, IsNil)
-
- idx := &Idxfile{}
- d := NewDecoder(bytes.NewBuffer(expected))
- err = d.Decode(idx)
- c.Assert(err, IsNil)
-
- result := bytes.NewBuffer(nil)
- e := NewEncoder(result)
- size, err := e.Encode(idx)
- c.Assert(err, IsNil)
-
- c.Assert(size, Equals, len(expected))
- c.Assert(result.Bytes(), DeepEquals, expected)
- })
-}