diff options
| author | 2026-02-20 19:06:13 +0800 | |
|---|---|---|
| committer | 2026-02-20 19:07:14 +0800 | |
| commit | aa513c069c1418734aea894dc944e27c6a78a3bb (patch) | |
| tree | 687f0a11bb550fa088fd82a98ceb8979bbc35f69 /hash_test.go | |
| parent | Comment on prior reverts removing the pack writing API (diff) | |
| signature | No signature | |
Delete everything, I'm redesigning this.
I'll stop using a flat package and make things much more modular.
And also experiment with streaming APIs so large blobs don't OOM us.
Diffstat (limited to 'hash_test.go')
| -rw-r--r-- | hash_test.go | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/hash_test.go b/hash_test.go deleted file mode 100644 index 0b15fd38..00000000 --- a/hash_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package furgit - -import ( - "testing" -) - -func TestHashParse(t *testing.T) { - repoPath, cleanup := setupTestRepo(t) - defer cleanup() - - repo, err := OpenRepository(repoPath) - if err != nil { - t.Fatalf("OpenRepository failed: %v", err) - } - defer func() { - _ = repo.Close() - }() - - var validHash string - var expectedSize int - if repo.hashAlgo.Size() == 32 { - validHash = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - expectedSize = 32 - } else { - validHash = "0123456789abcdef0123456789abcdef01234567" - expectedSize = 20 - } - - hash, err := repo.ParseHash(validHash) - if err != nil { - t.Fatalf("ParseHash failed: %v", err) - } - if hash.String() != validHash { - t.Errorf("String(): got %q, want %q", hash.String(), validHash) - } - if hash.Size() != expectedSize { - t.Errorf("Size(): got %d, want %d", hash.Size(), expectedSize) - } - - hashBytes := hash.Bytes() - if len(hashBytes) != expectedSize { - t.Errorf("Bytes() length: got %d, want %d", len(hashBytes), expectedSize) - } -} - -func TestHashParseErrors(t *testing.T) { - repoPath, cleanup := setupTestRepo(t) - defer cleanup() - - repo, err := OpenRepository(repoPath) - if err != nil { - t.Fatalf("OpenRepository failed: %v", err) - } - defer func() { - _ = repo.Close() - }() - - tests := []struct { - name string - hash string - }{ - {"invalid chars", "invalid"}, - {"wrong length", "0123456789abcdef"}, - {"non-hex", "0123456789abcdefg123456789abcdef0123456789abcdef0123456789abcdef"}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - _, err := repo.ParseHash(tt.hash) - if err == nil { - t.Errorf("expected error for %s", tt.name) - } - }) - } -} |
