aboutsummaryrefslogtreecommitdiffstats
path: root/formats/index/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/index/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/index/encoder_test.go')
-rw-r--r--formats/index/encoder_test.go78
1 files changed, 0 insertions, 78 deletions
diff --git a/formats/index/encoder_test.go b/formats/index/encoder_test.go
deleted file mode 100644
index 3085988..0000000
--- a/formats/index/encoder_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package index
-
-import (
- "bytes"
- "strings"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/src-d/go-git.v4/core"
-)
-
-func (s *IdxfileSuite) TestEncode(c *C) {
- idx := &Index{
- Version: 2,
- Entries: []Entry{{
- CreatedAt: time.Now(),
- ModifiedAt: time.Now(),
- Dev: 4242,
- Inode: 424242,
- UID: 84,
- GID: 8484,
- Size: 42,
- Stage: TheirMode,
- Hash: core.NewHash("e25b29c8946e0e192fae2edc1dabf7be71e8ecf3"),
- Name: "foo",
- }, {
- CreatedAt: time.Now(),
- ModifiedAt: time.Now(),
- Name: strings.Repeat(" ", 20),
- Size: 82,
- }},
- }
-
- buf := bytes.NewBuffer(nil)
- e := NewEncoder(buf)
- err := e.Encode(idx)
- c.Assert(err, IsNil)
-
- output := &Index{}
- d := NewDecoder(buf)
- err = d.Decode(output)
- c.Assert(err, IsNil)
-
- c.Assert(idx, DeepEquals, output)
-}
-
-func (s *IdxfileSuite) TestEncodeUnsuportedVersion(c *C) {
- idx := &Index{Version: 3}
-
- buf := bytes.NewBuffer(nil)
- e := NewEncoder(buf)
- err := e.Encode(idx)
- c.Assert(err, Equals, ErrUnsupportedVersion)
-}
-
-func (s *IdxfileSuite) TestEncodeWithIntentToAddUnsuportedVersion(c *C) {
- idx := &Index{
- Version: 2,
- Entries: []Entry{{IntentToAdd: true}},
- }
-
- buf := bytes.NewBuffer(nil)
- e := NewEncoder(buf)
- err := e.Encode(idx)
- c.Assert(err, Equals, ErrUnsupportedVersion)
-}
-
-func (s *IdxfileSuite) TestEncodeWithSkipWorktreeUnsuportedVersion(c *C) {
- idx := &Index{
- Version: 2,
- Entries: []Entry{{SkipWorktree: true}},
- }
-
- buf := bytes.NewBuffer(nil)
- e := NewEncoder(buf)
- err := e.Encode(idx)
- c.Assert(err, Equals, ErrUnsupportedVersion)
-}