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

Method TestObjects

repository_test.go:3079–3099  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

3077}
3078
3079func (s *RepositorySuite) TestObjects(c *C) {
3080 r, _ := Init(memory.NewStorage(), nil)
3081 err := r.clone(context.Background(), &CloneOptions{URL: s.GetBasicLocalRepositoryURL()})
3082 c.Assert(err, IsNil)
3083
3084 count := 0
3085 objects, err := r.Objects()
3086 c.Assert(err, IsNil)
3087 for {
3088 o, err := objects.Next()
3089 if err != nil {
3090 break
3091 }
3092
3093 count++
3094 c.Assert(o.ID().IsZero(), Equals, false)
3095 c.Assert(o.Type(), Not(Equals), plumbing.AnyObject)
3096 }
3097
3098 c.Assert(count, Equals, 31)
3099}
3100
3101func (s *RepositorySuite) TestObjectNotFound(c *C) {
3102 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 9

NewStorageFunction · 0.92
InitFunction · 0.85
cloneMethod · 0.80
NextMethod · 0.65
IsZeroMethod · 0.65
IDMethod · 0.65
TypeMethod · 0.65
ObjectsMethod · 0.45

Tested by

no test coverage detected