diff --git a/cid_test.go b/cid_test.go index 5d07497..9d0f9a1 100644 --- a/cid_test.go +++ b/cid_test.go @@ -584,3 +584,14 @@ func TestReadCidsFromBuffer(t *testing.T) { t.Fatal("had trailing bytes") } } + +func TestBadParse(t *testing.T) { + hash, err := mh.Sum([]byte("foobar"), mh.SHA3_256, -1) + if err != nil { + t.Fatal(err) + } + _, err = Parse(hash) + if err == nil { + t.Fatal("expected to fail to parse an invalid CIDv1 CID") + } +}