diff options
| author | 2026-05-24 07:19:19 +0000 | |
|---|---|---|
| committer | 2026-05-24 07:19:19 +0000 | |
| commit | 2aae0e0e0beca49b3d9b7fb051986a425ce91643 (patch) | |
| tree | cefb6cae76f6cd3463c4150851ac6c65b8f14e6f /object/blob/parse_test.go | |
| parent | REFACTOR: update progress (diff) | |
| signature | No signature | |
object/blob: Start
Diffstat (limited to 'object/blob/parse_test.go')
| -rw-r--r-- | object/blob/parse_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/object/blob/parse_test.go b/object/blob/parse_test.go new file mode 100644 index 00000000..09d5d5d0 --- /dev/null +++ b/object/blob/parse_test.go @@ -0,0 +1,30 @@ +package blob_test + +import ( + "bytes" + "testing" + + "codeberg.org/lindenii/furgit/internal/testgit" + "codeberg.org/lindenii/furgit/object/blob" + objectid "codeberg.org/lindenii/furgit/object/id" +) + +func TestBlobParseFromGit(t *testing.T) { + t.Parallel() + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { //nolint:thelper + testRepo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true}) + body := []byte("hello\nblob\n") + blobID := testRepo.HashObject(t, "blob", body) + + rawBody := testRepo.CatFile(t, "blob", blobID) + + parsed, err := blob.Parse(rawBody) + if err != nil { + t.Fatalf("ParseBlob: %v", err) + } + + if !bytes.Equal(parsed.Data, body) { + t.Fatalf("blob body mismatch") + } + }) +} |
