diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-21 16:03:39 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-21 16:03:39 +0100 |
commit | ed288b30de1ac3dcb3ce675c4b9af89eb4e6fcba (patch) | |
tree | 6eb908b839d6c225d95691d91e3d5ef5220f54c1 /storage/test/storage_suite.go | |
parent | d6a6decd1be0515faf36256ce06c58c7d662bbd0 (diff) | |
download | go-git-ed288b30de1ac3dcb3ce675c4b9af89eb4e6fcba.tar.gz |
documentation and API improvements
Diffstat (limited to 'storage/test/storage_suite.go')
-rw-r--r-- | storage/test/storage_suite.go | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index d6c8afa..2a10c78 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -22,7 +22,6 @@ type Storer interface { storer.ShallowStorer storer.IndexStorer config.ConfigStorer - storage.ModuleStorer } @@ -245,6 +244,33 @@ func (s *BaseStorageSuite) TestSetReferenceAndGetReference(c *C) { c.Assert(e.Hash().String(), Equals, "bc9968d75e48de59f0870ffb71f5e160bbbdcf52") } +func (s *BaseStorageSuite) TestRemoveReference(c *C) { + err := s.Storer.SetReference( + plumbing.NewReferenceFromStrings("foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"), + ) + c.Assert(err, IsNil) + + err = s.Storer.RemoveReference(plumbing.ReferenceName("foo")) + c.Assert(err, IsNil) + + _, err = s.Storer.Reference(plumbing.ReferenceName("foo")) + c.Assert(err, Equals, plumbing.ErrReferenceNotFound) +} + +func (s *BaseStorageSuite) TestRemoveReferenceNonExistent(c *C) { + err := s.Storer.SetReference( + plumbing.NewReferenceFromStrings("foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"), + ) + c.Assert(err, IsNil) + + err = s.Storer.RemoveReference(plumbing.ReferenceName("nonexistent")) + c.Assert(err, IsNil) + + e, err := s.Storer.Reference(plumbing.ReferenceName("foo")) + c.Assert(err, IsNil) + c.Assert(e.Hash().String(), Equals, "bc9968d75e48de59f0870ffb71f5e160bbbdcf52") +} + func (s *BaseStorageSuite) TestGetReferenceNotFound(c *C) { r, err := s.Storer.Reference(plumbing.ReferenceName("bar")) c.Assert(err, Equals, plumbing.ErrReferenceNotFound) @@ -297,7 +323,9 @@ func (s *BaseStorageSuite) TestSetConfigAndConfig(c *C) { cfg, err := s.Storer.Config() c.Assert(err, IsNil) - c.Assert(cfg, DeepEquals, expected) + + c.Assert(cfg.Core.IsBare, DeepEquals, expected.Core.IsBare) + c.Assert(cfg.Remotes, DeepEquals, expected.Remotes) } func (s *BaseStorageSuite) TestIndex(c *C) { |