aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/index/index_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-04-17 17:36:28 +0200
committerGitHub <noreply@github.com>2017-04-17 17:36:28 +0200
commitc991d2d1c2253ac246441bc92bf97804a73c0bf2 (patch)
tree9a6965fb0023262ea17d02bcedd9f48204a80750 /plumbing/format/index/index_test.go
parent057f1dd4fa44df509cb96977c0a8193407a22767 (diff)
parent4b0fc1eb6937b6e5f8569794e8b669443e2c7584 (diff)
downloadgo-git-c991d2d1c2253ac246441bc92bf97804a73c0bf2.tar.gz
Merge pull request #344 from mcuadros/submodules-checkout
worktree: reset and checkout support for submodules
Diffstat (limited to 'plumbing/format/index/index_test.go')
-rw-r--r--plumbing/format/index/index_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/plumbing/format/index/index_test.go b/plumbing/format/index/index_test.go
new file mode 100644
index 0000000..8c915d8
--- /dev/null
+++ b/plumbing/format/index/index_test.go
@@ -0,0 +1,22 @@
+package index
+
+import (
+ . "gopkg.in/check.v1"
+)
+
+func (s *IndexSuite) TestIndexEntry(c *C) {
+ idx := &Index{
+ Entries: []Entry{
+ {Name: "foo", Size: 42},
+ {Name: "bar", Size: 82},
+ },
+ }
+
+ e, err := idx.Entry("foo")
+ c.Assert(err, IsNil)
+ c.Assert(e.Name, Equals, "foo")
+
+ e, err = idx.Entry("missing")
+ c.Assert(err, Equals, ErrEntryNotFound)
+ c.Assert(e.Name, Equals, "")
+}