44da954565
To make the definition of supported digests more clear, we have refactored the digest package to have a special Algorithm type. This represents the digest's prefix and we associated various supported hash implementations through function calls. Signed-off-by: Stephen J Day <stephen.day@docker.com>
21 lines
511 B
Go
21 lines
511 B
Go
// +build !noresumabledigest
|
|
|
|
package digest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stevvooe/resumable"
|
|
_ "github.com/stevvooe/resumable/sha256"
|
|
)
|
|
|
|
// TestResumableDetection just ensures that the resumable capability of a hash
|
|
// is exposed through the digester type, which is just a hash plus a Digest
|
|
// method.
|
|
func TestResumableDetection(t *testing.T) {
|
|
d := Canonical.New()
|
|
|
|
if _, ok := d.Hash().(resumable.Hash); !ok {
|
|
t.Fatalf("expected digester to implement resumable.Hash: %#v, %v", d, d.Hash())
|
|
}
|
|
}
|