blob: eafc6172620079fb64f754a151e92dbae8465a78 (
plain) (
tree)
|
|
package packfile
import (
"bytes"
"testing"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/storage/memory"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
type CommonSuite struct{}
var _ = Suite(&CommonSuite{})
func (s *CommonSuite) TestEmptyUpdateObjectStorage(c *C) {
var buf bytes.Buffer
sto := memory.NewStorage()
err := UpdateObjectStorage(sto, &buf)
c.Assert(err, Equals, ErrEmptyPackfile)
}
func newObject(t plumbing.ObjectType, cont []byte) plumbing.EncodedObject {
o := plumbing.MemoryObject{}
o.SetType(t)
o.SetSize(int64(len(cont)))
o.Write(cont)
return &o
}
type piece struct {
val string
times int
}
func genBytes(elements []piece) []byte {
var result []byte
for _, e := range elements {
for i := 0; i < e.times; i++ {
result = append(result, e.val...)
}
}
return result
}
|