blob: ad0f7ef330dcc428b3698783f70650c3ca1df671 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package object_test
import (
"bytes"
"testing"
"codeberg.org/lindenii/furgit/internal/testgit"
"codeberg.org/lindenii/furgit/object"
"codeberg.org/lindenii/furgit/objectid"
)
func TestBlobParseFromGit(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
repo := testgit.NewBareRepo(t, algo)
body := []byte("hello\nblob\n")
blobID := repo.HashObject(t, "blob", body)
rawBody := repo.CatFile(t, "blob", blobID)
blob, err := object.ParseBlob(rawBody)
if err != nil {
t.Fatalf("ParseBlob: %v", err)
}
if !bytes.Equal(blob.Data, body) {
t.Fatalf("blob body mismatch")
}
})
}
|