From 05e07f6c6aca1662c33359f41c66e6f9b6eb935a Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 20 Feb 2026 21:19:47 +0800 Subject: testgit: Add test harnesses --- internal/testgit/algorithms.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/testgit/algorithms.go (limited to 'internal/testgit/algorithms.go') 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) + }) + } +} -- cgit v1.3.1-10-gc9f91