From 9a9f2b1f63a98fad67a3190ef813428b68dfdd8c Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sat, 28 Jan 2017 16:26:14 +0100 Subject: storage: IndexStorer implementation --- storage/test/storage_suite.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'storage/test/storage_suite.go') diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index bf0d10d..088edce 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -9,6 +9,7 @@ import ( "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/format/index" "gopkg.in/src-d/go-git.v4/plumbing/storer" . "gopkg.in/check.v1" @@ -18,6 +19,7 @@ type Storer interface { storer.EncodedObjectStorer storer.ReferenceStorer storer.ShallowStorer + storer.IndexStorer config.ConfigStorer } @@ -295,6 +297,18 @@ func (s *BaseStorageSuite) TestSetConfigAndConfig(c *C) { c.Assert(cfg, DeepEquals, expected) } +func (s *BaseStorageSuite) TestSetIndexAndIndex(c *C) { + expected := &index.Index{} + expected.Version = 2 + + err := s.Storer.SetIndex(expected) + c.Assert(err, IsNil) + + idx, err := s.Storer.Index() + c.Assert(err, IsNil) + c.Assert(idx, DeepEquals, expected) +} + func (s *BaseStorageSuite) TestSetConfigInvalid(c *C) { cfg := config.NewConfig() cfg.Remotes["foo"] = &config.RemoteConfig{} -- cgit From de1c0bfec0269ff2a31b62d13612d833da178ec4 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sun, 29 Jan 2017 02:16:26 +0100 Subject: storage: IndexStorer implementation --- storage/test/storage_suite.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'storage/test/storage_suite.go') diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index 088edce..ca2f783 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -297,6 +297,15 @@ func (s *BaseStorageSuite) TestSetConfigAndConfig(c *C) { c.Assert(cfg, DeepEquals, expected) } +func (s *BaseStorageSuite) TestIndex(c *C) { + expected := &index.Index{} + expected.Version = 2 + + idx, err := s.Storer.Index() + c.Assert(err, IsNil) + c.Assert(idx, DeepEquals, expected) +} + func (s *BaseStorageSuite) TestSetIndexAndIndex(c *C) { expected := &index.Index{} expected.Version = 2 -- cgit