MCPcopy Create free account
hub / github.com/go-git/go-git / TestHash

Method TestHash

plumbing/memory_test.go:13–25  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

11var _ = Suite(&MemoryObjectSuite{})
12
13func (s *MemoryObjectSuite) TestHash(c *C) {
14 o := &MemoryObject{}
15 o.SetType(BlobObject)
16 o.SetSize(14)
17
18 _, err := o.Write([]byte("Hello, World!\n"))
19 c.Assert(err, IsNil)
20
21 c.Assert(o.Hash().String(), Equals, "8ab686eafeb1f44702738c8b0f24f2567c36da6d")
22
23 o.SetType(CommitObject)
24 c.Assert(o.Hash().String(), Equals, "8ab686eafeb1f44702738c8b0f24f2567c36da6d")
25}
26
27func (s *MemoryObjectSuite) TestHashNotFilled(c *C) {
28 o := &MemoryObject{}

Callers

nothing calls this directly

Calls 5

SetTypeMethod · 0.95
SetSizeMethod · 0.95
WriteMethod · 0.95
HashMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected