diff --git a/fs/hash/hash.go b/fs/hash/hash.go index 4540b40cf..23956cee6 100644 --- a/fs/hash/hash.go +++ b/fs/hash/hash.go @@ -55,6 +55,16 @@ func RegisterHash(name, alias string, width int, newFunc func() hash.Hash) Type return hashType } +// SupportOnly makes the hash package only support the types passed +// in. Used for testing. +// +// It returns the previously supported types. +func SupportOnly(new []Type) (old []Type) { + old = supported + supported = new + return old +} + // ErrUnsupported should be returned by filesystem, // if it is requested to deliver an unsupported hash type. var ErrUnsupported = errors.New("hash type not supported")