panic if hash returns an error

Add a sanity check that the interface contract is honoured.
This commit is contained in:
Michael Eischer
2021-01-29 22:12:51 +01:00
parent 51b7e3119b
commit 7c1903e1ee
4 changed files with 16 additions and 4 deletions

View File

@@ -547,7 +547,10 @@ func (s *Suite) TestSave(t *testing.T) {
if b.Hasher() != nil {
beHasher := b.Hasher()
// must never fail according to interface
_, _ = beHasher.Write(data)
_, err := beHasher.Write(data)
if err != nil {
panic(err)
}
beHash = beHasher.Sum(nil)
}
err = b.Save(context.TODO(), h, errorCloser{