aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/index/index_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-05-21 12:54:29 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-05-21 12:54:29 +0200
commit52add52ea3f92a2a092e6879b6d75fb1279430d5 (patch)
treed53451935a81f90f4da8727a6af1d61952712ae8 /plumbing/format/index/index_test.go
parent0f2abe7da065ed25085ea265db20e77609cefdbc (diff)
downloadgo-git-52add52ea3f92a2a092e6879b6d75fb1279430d5.tar.gz
worktree: Remove and Move methods
Diffstat (limited to 'plumbing/format/index/index_test.go')
-rw-r--r--plumbing/format/index/index_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/plumbing/format/index/index_test.go b/plumbing/format/index/index_test.go
index 67286b3..cad5f9c 100644
--- a/plumbing/format/index/index_test.go
+++ b/plumbing/format/index/index_test.go
@@ -20,3 +20,20 @@ func (s *IndexSuite) TestIndexEntry(c *C) {
c.Assert(e, IsNil)
c.Assert(err, Equals, ErrEntryNotFound)
}
+
+func (s *IndexSuite) TestIndexRemove(c *C) {
+ idx := &Index{
+ Entries: []*Entry{
+ {Name: "foo", Size: 42},
+ {Name: "bar", Size: 82},
+ },
+ }
+
+ e, err := idx.Remove("foo")
+ c.Assert(err, IsNil)
+ c.Assert(e.Name, Equals, "foo")
+
+ e, err = idx.Remove("foo")
+ c.Assert(e, IsNil)
+ c.Assert(err, Equals, ErrEntryNotFound)
+}