diff options
author | Santiago M. Mola <santi@mola.io> | 2017-02-13 17:04:30 +0100 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-02-16 18:15:20 +0100 |
commit | 53385d62c573e0e2ef67587099cce0144cf60b3c (patch) | |
tree | 7e4315a2a18a46cf691c19d5ae2e96eb84e96c18 /storage/test | |
parent | f5a9c7ed5ab58afa255c2f405b30f06f88a6aecf (diff) | |
download | go-git-53385d62c573e0e2ef67587099cce0144cf60b3c.tar.gz |
plumbing/storer: add RemoveReference
Diffstat (limited to 'storage/test')
-rw-r--r-- | storage/test/storage_suite.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index 6fc2937..e09a673 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -242,6 +242,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) |