diff options
| author | 2026-02-20 21:19:47 +0800 | |
|---|---|---|
| committer | 2026-02-20 21:34:42 +0800 | |
| commit | 05e07f6c6aca1662c33359f41c66e6f9b6eb935a (patch) | |
| tree | 6928a76783b2230a010c36d53b8da48ff24d611f /internal/testgit/algorithms.go | |
| parent | oid: Add ObjectID (diff) | |
| signature | No signature | |
testgit: Add test harnesses
Diffstat (limited to 'internal/testgit/algorithms.go')
| -rw-r--r-- | internal/testgit/algorithms.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/testgit/algorithms.go b/internal/testgit/algorithms.go new file mode 100644 index 00000000..833b846b --- /dev/null +++ b/internal/testgit/algorithms.go @@ -0,0 +1,25 @@ +package testgit + +import ( + "testing" + + "codeberg.org/lindenii/furgit/oid" +) + +// SupportedAlgorithms returns all object ID algorithms supported by furgit. +func SupportedAlgorithms() []oid.Algorithm { + return []oid.Algorithm{ + oid.AlgorithmSHA1, + oid.AlgorithmSHA256, + } +} + +// ForEachAlgorithm runs a subtest for every supported algorithm. +func ForEachAlgorithm(t *testing.T, fn func(t *testing.T, algo oid.Algorithm)) { + t.Helper() + for _, algo := range SupportedAlgorithms() { + t.Run(algo.String(), func(t *testing.T) { + fn(t, algo) + }) + } +} |
