MCPcopy Index your code
hub / github.com/go-git/go-git / TestHasEncodedObject

Method TestHasEncodedObject

storage/transactional/object_test.go:14–42  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

12type ObjectSuite struct{}
13
14func (s *ObjectSuite) TestHasEncodedObject(c *C) {
15 base := memory.NewStorage()
16 temporal := memory.NewStorage()
17
18 os := NewObjectStorage(base, temporal)
19
20 commit := base.NewEncodedObject()
21 commit.SetType(plumbing.CommitObject)
22
23 ch, err := base.SetEncodedObject(commit)
24 c.Assert(ch.IsZero(), Equals, false)
25 c.Assert(err, IsNil)
26
27 tree := base.NewEncodedObject()
28 tree.SetType(plumbing.TreeObject)
29
30 th, err := os.SetEncodedObject(tree)
31 c.Assert(th.IsZero(), Equals, false)
32 c.Assert(err, IsNil)
33
34 err = os.HasEncodedObject(th)
35 c.Assert(err, IsNil)
36
37 err = os.HasEncodedObject(ch)
38 c.Assert(err, IsNil)
39
40 err = base.HasEncodedObject(th)
41 c.Assert(err, Equals, plumbing.ErrObjectNotFound)
42}
43
44func (s *ObjectSuite) TestEncodedObjectAndEncodedObjectSize(c *C) {
45 base := memory.NewStorage()

Callers

nothing calls this directly

Calls 9

SetTypeMethod · 0.95
SetEncodedObjectMethod · 0.95
HasEncodedObjectMethod · 0.95
NewStorageFunction · 0.92
NewObjectStorageFunction · 0.70
NewEncodedObjectMethod · 0.65
SetEncodedObjectMethod · 0.65
IsZeroMethod · 0.65
HasEncodedObjectMethod · 0.65

Tested by

no test coverage detected